home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / M / MacStarter.sit / other applicationProcs files / kaleidoSketch.c next >
MacBinary  |  1992-10-11  |  18.6 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: kaleidoSketch.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sun Oct 11 15:41:48 1992, modified Sun Oct 11 15:41:48 1992, creator Think C, type ASCII, 18035 bytes "kaleidoSketch.c" , at 0x46f3 798 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0f 6b 61 6c 65 69 64 | 6f 53 6b 65 74 63 68 2e |..kaleid|oSketch.|
|00000010| 63 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |c.......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 00 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 46 73 00 | 00 03 1e a6 fe 33 fc a6 |.....Fs.|.....3..|
|00000060| fe 33 fc 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.3......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 63 0a 00 00 |........|....c...|
|00000080| 2f 2a 20 54 68 69 73 20 | 66 69 6c 65 20 64 65 6d |/* This |file dem|
|00000090| 6f 6e 73 74 72 61 74 65 | 73 20 73 6f 6d 65 20 73 |onstrate|s some s|
|000000a0| 6c 69 67 68 74 6c 79 20 | 73 6f 70 68 69 73 74 69 |lightly |sophisti|
|000000b0| 63 61 74 65 64 20 64 72 | 61 77 69 6e 67 2c 20 0d |cated dr|awing, .|
|000000c0| 20 20 20 61 73 20 77 65 | 6c 6c 20 61 73 20 62 61 | as we|ll as ba|
|000000d0| 73 69 63 20 75 73 65 20 | 6f 66 20 66 69 6c 65 73 |sic use |of files|
|000000e0| 20 69 6e 20 4d 61 63 53 | 74 61 72 74 65 72 2e 0d | in MacS|tarter..|
|000000f0| 20 20 20 54 6f 20 75 73 | 65 20 74 68 69 73 20 66 | To us|e this f|
|00000100| 69 6c 65 2c 20 79 6f 75 | 20 73 68 6f 75 6c 64 20 |ile, you| should |
|00000110| 61 64 64 20 69 74 20 74 | 6f 20 74 68 65 20 4d 61 |add it t|o the Ma|
|00000120| 63 53 74 61 72 74 65 72 | 2e b9 20 70 72 6f 6a 65 |cStarter|.. proje|
|00000130| 63 74 0d 20 20 20 61 6e | 64 20 64 65 6c 65 74 65 |ct. an|d delete|
|00000140| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 61 70 70 | the cur|rent app|
|00000150| 6c 69 63 61 74 69 6f 6e | 50 72 6f 63 73 20 66 69 |lication|Procs fi|
|00000160| 6c 65 2e 20 20 54 68 65 | 20 66 69 6c 65 0d 20 20 |le. The| file. |
|00000170| 20 69 6e 70 75 74 42 6f | 78 65 73 2e 63 20 6d 75 | inputBo|xes.c mu|
|00000180| 73 74 20 61 6c 73 6f 20 | 62 65 20 70 72 65 73 65 |st also |be prese|
|00000190| 6e 74 20 69 6e 20 74 68 | 65 20 4d 61 63 53 74 61 |nt in th|e MacSta|
|000001a0| 72 74 65 72 2e b9 20 70 | 72 6f 6a 65 63 74 0d 20 |rter.. p|roject. |
|000001b0| 20 20 77 69 6e 64 6f 77 | 2e 0d 20 20 20 20 20 20 | window|.. |
|000001c0| 20 57 68 65 6e 20 75 73 | 69 6e 67 20 74 68 69 73 | When us|ing this|
|000001d0| 20 70 72 6f 67 72 61 6d | 2c 20 74 68 65 20 75 73 | program|, the us|
|000001e0| 65 72 20 64 72 61 77 73 | 20 69 6e 20 61 20 77 69 |er draws| in a wi|
|000001f0| 6e 64 6f 77 20 75 73 69 | 6e 67 20 74 68 65 0d 20 |ndow usi|ng the. |
|00000200| 20 20 6d 6f 75 73 65 2e | 20 20 54 68 65 20 63 75 | mouse.| The cu|
|00000210| 72 76 65 20 74 72 61 63 | 65 64 20 62 79 20 74 68 |rve trac|ed by th|
|00000220| 65 20 6d 6f 75 73 65 20 | 69 73 20 64 72 61 77 6e |e mouse |is drawn|
|00000230| 2c 20 61 6c 6f 6e 67 20 | 77 69 74 68 20 69 74 73 |, along |with its|
|00000240| 0d 20 20 20 73 65 76 65 | 6e 20 22 72 65 66 6c 65 |. seve|n "refle|
|00000250| 63 74 69 6f 6e 73 22 2c | 20 67 69 76 69 6e 67 20 |ctions",| giving |
|00000260| 61 20 70 72 65 74 74 79 | 28 3f 29 2c 20 73 79 6d |a pretty|(?), sym|
|00000270| 6d 65 74 72 69 63 20 70 | 61 74 74 65 72 6e 2e 20 |metric p|attern. |
|00000280| 20 53 6b 65 74 63 68 65 | 73 0d 20 20 20 63 61 6e | Sketche|s. can|
|00000290| 20 62 65 20 73 61 76 65 | 64 20 74 6f 20 66 69 6c | be save|d to fil|
|000002a0| 65 73 20 61 6e 64 20 72 | 65 6c 6f 61 64 65 64 2e |es and r|eloaded.|
|000002b0| 0d 20 20 20 20 20 20 20 | 41 6c 6c 20 70 6c 61 63 |. |All plac|
|000002c0| 65 73 20 77 68 65 72 65 | 20 74 68 69 73 20 66 69 |es where| this fi|
|000002d0| 6c 65 20 68 61 73 20 62 | 65 65 6e 20 6d 6f 64 69 |le has b|een modi|
|000002e0| 66 69 65 64 20 28 66 72 | 6f 6d 20 74 68 65 20 0d |fied (fr|om the .|
|000002f0| 20 20 20 6f 72 69 67 69 | 6e 61 6c 20 61 70 70 6c | origi|nal appl|
|00000300| 69 63 61 74 69 6f 6e 50 | 72 6f 63 73 2e 63 29 20 |icationP|rocs.c) |
|00000310| 61 72 65 20 63 6f 6d 6d | 65 6e 74 65 64 20 77 69 |are comm|ented wi|
|00000320| 74 68 20 63 6f 6d 6d 65 | 6e 74 73 0d 20 20 20 74 |th comme|nts. t|
|00000330| 68 61 74 20 62 65 67 69 | 6e 20 77 69 74 68 20 2f |hat begi|n with /|
|00000340| 2f 0d 2a 2f 0d 0d 0d 23 | 69 6e 63 6c 75 64 65 20 |/.*/...#|include |
|00000350| 22 67 6c 6f 62 61 6c 73 | 2d 4d 61 63 53 74 61 72 |"globals|-MacStar|
|00000360| 74 65 72 2e 68 22 0d 23 | 69 6e 63 6c 75 64 65 20 |ter.h".#|include |
|00000370| 22 69 6e 70 75 74 42 6f | 78 65 73 2e 68 22 0d 0d |"inputBo|xes.h"..|
|00000380| 6c 6f 6e 67 20 67 45 76 | 65 6e 74 57 61 69 74 54 |long gEv|entWaitT|
|00000390| 69 6d 65 20 3d 20 31 30 | 30 30 30 30 3b 0d 0d 4d |ime = 10|0000;..M|
|000003a0| 65 6e 75 48 61 6e 64 6c | 65 20 65 64 69 74 4d 65 |enuHandl|e editMe|
|000003b0| 6e 75 2c 20 66 69 6c 65 | 4d 65 6e 75 3b 0d 0d 76 |nu, file|Menu;..v|
|000003c0| 6f 69 64 20 49 6e 69 74 | 41 70 70 6c 69 63 61 74 |oid Init|Applicat|
|000003d0| 69 6f 6e 28 76 6f 69 64 | 29 3b 0d 76 6f 69 64 20 |ion(void|);.void |
|000003e0| 55 70 64 61 74 65 4d 65 | 6e 75 73 28 76 6f 69 64 |UpdateMe|nus(void|
|000003f0| 29 3b 0d 76 6f 69 64 20 | 44 6f 45 64 69 74 4d 65 |);.void |DoEditMe|
|00000400| 6e 75 28 69 6e 74 20 69 | 74 65 6d 4e 75 6d 29 3b |nu(int i|temNum);|
|00000410| 0d 76 6f 69 64 20 44 6f | 46 69 6c 65 4d 65 6e 75 |.void Do|FileMenu|
|00000420| 28 69 6e 74 20 69 74 65 | 6d 4e 75 6d 2c 20 69 6e |(int ite|mNum, in|
|00000430| 74 2a 20 64 6f 6e 65 29 | 3b 0d 76 6f 69 64 20 44 |t* done)|;.void D|
|00000440| 6f 4f 74 68 65 72 4d 65 | 6e 75 28 69 6e 74 20 6d |oOtherMe|nu(int m|
|00000450| 65 6e 75 49 44 2c 20 69 | 6e 74 20 69 74 65 6d 4e |enuID, i|nt itemN|
|00000460| 75 6d 29 3b 0d 76 6f 69 | 64 20 41 70 70 6c 69 63 |um);.voi|d Applic|
|00000470| 61 74 69 6f 6e 49 64 6c | 65 28 76 6f 69 64 29 3b |ationIdl|e(void);|
|00000480| 0d 76 6f 69 64 20 43 6c | 65 61 6e 55 70 41 70 70 |.void Cl|eanUpApp|
|00000490| 6c 69 63 61 74 69 6f 6e | 28 76 6f 69 64 29 3b 0d |lication|(void);.|
|000004a0| 76 6f 69 64 20 41 62 6f | 75 74 42 6f 78 28 76 6f |void Abo|utBox(vo|
|000004b0| 69 64 29 3b 0d 76 6f 69 | 64 20 44 6f 4e 65 77 43 |id);.voi|d DoNewC|
|000004c0| 6f 6d 6d 61 6e 64 28 76 | 6f 69 64 29 3b 0d 0d 0d |ommand(v|oid);...|
|000004d0| 2f 2f 20 64 65 66 69 6e | 65 20 61 20 73 79 6d 62 |// defin|e a symb|
|000004e0| 6f 6c 69 63 20 63 6f 6e | 73 74 61 6e 74 20 73 70 |olic con|stant sp|
|000004f0| 65 63 69 66 79 69 6e 67 | 20 74 68 65 20 6d 61 78 |ecifying| the max|
|00000500| 69 6d 75 6d 20 6e 75 6d | 62 65 72 20 6f 66 20 70 |imum num|ber of p|
|00000510| 6f 69 6e 74 73 20 0d 2f | 2f 20 6f 6e 20 74 68 65 |oints ./|/ on the|
|00000520| 20 63 75 72 76 65 73 20 | 64 72 61 77 6e 20 62 79 | curves |drawn by|
|00000530| 20 74 68 65 20 75 73 65 | 72 20 69 6e 20 61 20 73 | the use|r in a s|
|00000540| 69 6e 67 6c 65 20 77 69 | 6e 64 6f 77 2e 0d 23 64 |ingle wi|ndow..#d|
|00000550| 65 66 69 6e 65 20 6d 61 | 78 50 6f 69 6e 74 73 20 |efine ma|xPoints |
|00000560| 31 30 30 30 0d 0d 73 68 | 6f 72 74 20 57 69 6e 64 |1000..sh|ort Wind|
|00000570| 6f 77 43 74 20 3d 20 30 | 3b 20 20 2f 2f 20 74 6f |owCt = 0|; // to|
|00000580| 20 6b 65 65 70 20 74 72 | 61 63 6b 20 6f 66 20 74 | keep tr|ack of t|
|00000590| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 77 69 6e |he numbe|r of win|
|000005a0| 64 6f 77 73 20 6f 70 65 | 6e 65 64 0d 20 20 20 20 |dows ope|ned. |
|000005b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000005c0| 20 2f 2f 20 62 79 20 74 | 68 65 20 70 72 6f 67 72 | // by t|he progr|
|000005d0| 61 6d 3b 20 73 65 65 20 | 66 75 6e 63 74 69 6f 6e |am; see |function|
|000005e0| 20 44 6f 4e 65 77 43 6f | 6d 6d 61 6e 64 20 62 65 | DoNewCo|mmand be|
|000005f0| 6c 6f 77 2e 0d 0d 76 6f | 69 64 20 64 6f 4f 70 65 |low...vo|id doOpe|
|00000600| 6e 28 76 6f 69 64 29 3b | 20 20 2f 2f 20 44 65 63 |n(void);| // Dec|
|00000610| 6c 61 72 65 20 61 20 66 | 75 6e 63 74 69 6f 6e 20 |lare a f|unction |
|00000620| 74 6f 20 63 61 72 72 79 | 20 6f 75 74 20 4f 70 65 |to carry| out Ope|
|00000630| 6e 20 43 6f 6d 6d 61 6e | 64 0d 0d 0d 63 6c 61 73 |n Comman|d...clas|
|00000640| 73 20 6d 79 57 69 6e 64 | 6f 77 20 3a 20 70 75 62 |s myWind|ow : pub|
|00000650| 6c 69 63 20 78 57 69 6e | 64 6f 77 20 7b 0d 0d 20 |lic xWin|dow {.. |
|00000660| 20 70 75 62 6c 69 63 3a | 0d 20 20 20 2f 2f 20 28 | public:|. // (|
|00000670| 4e 6f 74 65 3a 20 6e 6f | 74 20 61 6c 6c 20 74 68 |Note: no|t all th|
|00000680| 69 73 20 73 74 75 66 66 | 20 6e 65 65 64 73 20 74 |is stuff| needs t|
|00000690| 6f 20 62 65 20 70 75 62 | 6c 69 63 3b 20 49 20 61 |o be pub|lic; I a|
|000006a0| 6d 20 62 65 69 6e 67 20 | 6c 61 7a 79 20 68 65 72 |m being |lazy her|
|000006b0| 65 2e 0d 20 20 20 2f 2f | 20 20 49 74 20 77 61 73 |e.. //| It was|
|000006c0| 20 65 61 73 69 65 73 74 | 20 74 6f 20 6d 61 6b 65 | easiest| to make|
|000006d0| 20 65 76 65 72 79 74 68 | 69 6e 67 20 70 75 62 6c | everyth|ing publ|
|000006e0| 69 63 20 77 68 65 6e 20 | 49 20 6b 65 70 74 20 67 |ic when |I kept g|
|000006f0| 65 74 74 69 6e 67 0d 20 | 20 20 2f 2f 20 20 22 61 |etting. | // "a|
|00000700| 63 63 65 73 73 20 64 65 | 6e 69 65 64 22 20 65 72 |ccess de|nied" er|
|00000710| 72 6f 72 73 2c 20 72 61 | 74 68 65 72 20 74 68 61 |rors, ra|ther tha|
|00000720| 74 20 69 6d 70 72 6f 76 | 65 20 74 68 65 20 64 65 |t improv|e the de|
|00000730| 73 69 67 6e 2e 20 20 54 | 68 69 73 20 69 73 0d 20 |sign. T|his is. |
|00000740| 20 20 2f 2f 20 20 6e 6f | 74 20 73 6f 20 62 61 64 | // no|t so bad|
|00000750| 20 69 6e 20 61 20 73 6d | 61 6c 6c 20 70 72 6f 67 | in a sm|all prog|
|00000760| 72 61 6d 20 74 68 61 74 | 20 64 6f 65 73 6e 27 74 |ram that| doesn't|
|00000770| 20 68 61 76 65 20 74 6f | 20 62 65 20 6d 61 69 6e | have to| be main|
|00000780| 74 61 69 6e 65 64 2c 0d | 20 20 20 2f 2f 20 20 49 |tained,.| // I|
|00000790| 20 67 75 65 73 73 2e 29 | 0d 20 20 20 0d 20 20 20 | guess.)|. . |
|000007a0| 2f 2f 20 64 65 66 69 6e | 65 20 74 68 65 20 64 61 |// defin|e the da|
|000007b0| 74 61 20 74 68 61 74 20 | 69 73 20 72 65 6c 65 76 |ta that |is relev|
|000007c0| 61 6e 74 20 74 6f 20 74 | 68 65 20 63 6f 6e 74 65 |ant to t|he conte|
|000007d0| 6e 74 73 20 6f 66 20 74 | 68 69 73 20 70 61 72 74 |nts of t|his part|
|000007e0| 69 63 75 6c 61 72 20 77 | 69 6e 64 6f 77 3a 20 20 |icular w|indow: |
|000007f0| 20 0d 20 20 20 0d 20 20 | 20 73 68 6f 72 74 20 70 | . . | short p|
|00000800| 74 43 6f 75 6e 74 3b 20 | 20 20 20 20 20 20 20 2f |tCount; | /|
|00000810| 2f 20 68 6f 77 20 6d 61 | 6e 79 20 70 6f 69 6e 74 |/ how ma|ny point|
|00000820| 73 20 68 61 76 65 20 62 | 65 65 6e 20 64 72 61 77 |s have b|een draw|
|00000830| 6e 20 28 30 20 74 6f 20 | 6d 61 78 50 6f 69 6e 74 |n (0 to |maxPoint|
|00000840| 73 29 0d 20 20 20 0d 20 | 20 20 73 68 6f 72 74 20 |s). . | short |
|00000850| 61 6c 6c 46 69 6c 6c 65 | 64 55 70 3b 20 20 20 20 |allFille|dUp; |
|00000860| 2f 2f 20 74 68 69 73 20 | 69 73 20 69 6e 69 74 69 |// this |is initi|
|00000870| 61 6c 69 7a 65 64 20 74 | 6f 20 30 20 61 6e 64 20 |alized t|o 0 and |
|00000880| 69 73 20 73 65 74 20 74 | 6f 20 31 20 77 68 65 6e |is set t|o 1 when|
|00000890| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000008a0| 20 20 20 20 20 20 20 20 | 20 20 2f 2f 20 20 20 20 | | // |
|000008b0| 20 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 | the nu|mber of |
|000008c0| 70 6f 69 6e 74 73 20 66 | 69 72 73 74 20 72 65 61 |points f|irst rea|
|000008d0| 63 68 65 73 20 6d 61 78 | 50 6f 69 6e 74 73 0d 20 |ches max|Points. |
|000008e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000008f0| 20 20 20 20 20 20 20 20 | 2f 2f 20 20 20 20 20 20 | |// |
|00000900| 28 49 74 20 65 78 69 73 | 74 73 20 73 6f 20 74 68 |(It exis|ts so th|
|00000910| 61 74 20 49 20 63 61 6e | 20 61 76 6f 69 64 20 67 |at I can| avoid g|
|00000920| 69 76 69 6e 67 20 74 68 | 65 0d 20 20 20 20 20 20 |iving th|e. |
|00000930| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000940| 20 20 20 2f 2f 20 20 20 | 20 20 20 20 75 73 65 72 | // | user|
|00000950| 20 6d 6f 72 65 20 74 68 | 61 6e 20 6f 6e 65 20 22 | more th|an one "|
|00000960| 61 6c 6c 20 66 69 6c 6c | 65 64 20 75 70 22 20 6d |all fill|ed up" m|
|00000970| 65 73 73 61 67 65 0d 20 | 20 20 20 20 20 20 20 20 |essage. | |
|00000980| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000990| 2f 2f 20 20 20 20 20 20 | 20 70 65 72 20 77 69 6e |// | per win|
|000009a0| 64 6f 77 2e 29 0d 20 20 | 20 20 20 20 20 20 20 20 |dow.). | |
|000009b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 0d | | .|
|000009c0| 20 20 20 50 6f 69 6e 74 | 20 70 74 5b 6d 61 78 50 | Point| pt[maxP|
|000009d0| 6f 69 6e 74 73 5d 3b 20 | 20 20 20 20 20 2f 2f 20 |oints]; | // |
|000009e0| 41 20 6c 69 73 74 20 6f | 66 20 74 68 65 20 70 6f |A list o|f the po|
|000009f0| 69 6e 74 73 20 64 72 61 | 77 6e 20 62 79 20 74 68 |ints dra|wn by th|
|00000a00| 65 20 75 73 65 72 2e 20 | 20 41 73 20 74 68 65 0d |e user. | As the.|
|00000a10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000a20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 | | // |
|00000a30| 75 73 65 72 20 6d 6f 76 | 65 73 20 74 68 65 20 6d |user mov|es the m|
|00000a40| 6f 75 73 65 2c 20 61 20 | 6c 69 73 74 20 6f 66 20 |ouse, a |list of |
|00000a50| 70 6f 69 6e 74 73 20 74 | 72 61 76 65 72 73 65 64 |points t|raversed|
|00000a60| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000a70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2f | | //|
|00000a80| 20 69 73 20 6b 65 70 74 | 2e 20 20 54 68 65 20 63 | is kept|. The c|
|00000a90| 75 72 76 65 20 74 68 61 | 74 20 69 73 20 64 72 61 |urve tha|t is dra|
|00000aa0| 77 6e 20 69 73 20 6a 75 | 73 74 0d 20 20 20 20 20 |wn is ju|st. |
|00000ab0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ac0| 20 20 20 20 20 20 20 20 | 2f 2f 20 6f 62 74 61 69 | |// obtai|
|00000ad0| 6e 65 64 20 62 79 20 63 | 6f 6e 6e 65 63 74 69 6e |ned by c|onnectin|
|00000ae0| 67 20 74 68 65 73 65 20 | 70 6f 69 6e 74 73 2e 0d |g these |points..|
|00000af0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000b00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 | | // |
|00000b10| 54 68 65 20 73 70 65 63 | 69 61 6c 20 76 61 6c 75 |The spec|ial valu|
|00000b20| 65 20 6f 66 20 70 74 5b | 69 5d 2e 68 20 3d 20 2d |e of pt[|i].h = -|
|00000b30| 31 20 73 65 70 61 72 61 | 74 65 73 0d 20 20 20 20 |1 separa|tes. |
|00000b40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000b50| 20 20 20 20 20 20 20 20 | 20 2f 2f 20 73 65 71 75 | | // sequ|
|00000b60| 65 6e 63 65 73 20 6f 66 | 20 70 6f 69 6e 74 73 20 |ences of| points |
|00000b70| 6f 6e 20 64 69 66 66 65 | 72 65 6e 74 20 63 75 72 |on diffe|rent cur|
|00000b80| 76 65 73 2e 0d 20 20 20 | 20 20 20 20 20 20 20 20 |ves.. | |
|00000b90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ba0| 20 20 0d 20 20 20 73 68 | 6f 72 74 20 77 69 6e 57 | . sh|ort winW|
|00000bb0| 69 64 74 68 2c 77 69 6e | 48 65 69 67 68 74 3b 20 |idth,win|Height; |
|00000bc0| 2f 2f 20 57 68 65 6e 20 | 74 68 65 20 77 69 6e 64 |// When |the wind|
|00000bd0| 6f 77 20 63 68 61 6e 67 | 65 73 20 73 69 7a 65 2c |ow chang|es size,|
|00000be0| 20 74 68 65 20 70 6f 69 | 6e 74 73 20 69 6e 0d 20 | the poi|nts in. |
|00000bf0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000c00| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2f 20 61 | | // a|
|00000c10| 72 72 61 79 20 70 74 20 | 68 61 76 65 20 74 6f 20 |rray pt |have to |
|00000c20| 62 65 20 73 63 61 6c 65 | 64 20 74 6f 20 74 68 65 |be scale|d to the|
|00000c30| 20 6e 65 77 20 73 69 7a | 65 0d 20 20 20 20 20 20 | new siz|e. |
|00000c40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000c50| 20 20 20 20 20 20 20 2f | 2f 20 74 68 65 73 65 20 | /|/ these |
|00000c60| 76 61 72 69 61 62 6c 65 | 73 20 73 74 6f 72 65 20 |variable|s store |
|00000c70| 74 68 65 20 77 69 64 74 | 68 20 61 6e 64 20 68 65 |the widt|h and he|
|00000c80| 69 67 68 74 0d 20 20 20 | 20 20 20 20 20 20 20 20 |ight. | |
|00000c90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ca0| 20 20 2f 2f 20 62 79 20 | 77 68 69 63 68 20 74 68 | // by |which th|
|00000cb0| 65 20 70 6f 69 6e 74 73 | 20 61 72 65 20 63 75 72 |e points| are cur|
|00000cc0| 65 6e 74 6c 79 20 73 63 | 61 6c 65 64 2e 0d 20 20 |ently sc|aled.. |
|00000cd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ce0| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2f 20 28 54 | | // (T|
|00000cf0| 68 65 73 65 20 76 61 6c | 75 65 73 20 61 72 65 20 |hese val|ues are |
|00000d00| 63 68 61 6e 67 65 64 20 | 69 6e 20 66 75 6e 63 74 |changed |in funct|
|00000d10| 69 6f 6e 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ion. | |
|00000d20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000d30| 20 2f 2f 20 61 64 6a 75 | 73 74 54 6f 4e 65 77 53 | // adju|stToNewS|
|00000d40| 69 7a 65 2c 20 77 68 65 | 72 65 20 74 68 65 20 73 |ize, whe|re the s|
|00000d50| 63 61 6c 69 6e 67 20 69 | 73 20 64 6f 6e 65 2e 29 |caling i|s done.)|
|00000d60| 0d 20 20 20 0d 20 20 20 | 76 6f 69 64 20 64 6f 43 |. . |void doC|
|00000d70| 6c 65 61 72 28 76 6f 69 | 64 29 3b 20 20 20 2f 2f |lear(voi|d); //|
|00000d80| 20 46 75 6e 63 74 69 6f | 6e 20 74 6f 20 72 65 73 | Functio|n to res|
|00000d90| 70 6f 6e 64 20 74 6f 20 | 43 6c 65 61 72 20 63 6f |pond to |Clear co|
|00000da0| 6d 6d 61 6e 64 0d 20 20 | 20 0d 20 20 20 76 6f 69 |mmand. | . voi|
|00000db0| 64 20 64 6f 53 61 76 65 | 28 76 6f 69 64 29 3b 20 |d doSave|(void); |
|00000dc0| 20 20 20 2f 2f 20 46 75 | 6e 63 74 69 6f 6e 20 74 | // Fu|nction t|
|00000dd0| 6f 20 72 65 73 70 6f 6e | 64 20 74 6f 20 53 61 76 |o respon|d to Sav|
|00000de0| 65 20 63 6f 6d 6d 61 6e | 64 2e 0d 20 20 20 20 20 |e comman|d.. |
|00000df0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000e00| 20 20 20 20 2f 2f 20 28 | 4e 6f 74 65 3a 20 20 49 | // (|Note: I|
|00000e10| 20 70 75 74 20 64 6f 43 | 6c 65 61 72 20 61 6e 64 | put doC|lear and|
|00000e20| 20 64 6f 53 61 76 65 20 | 69 6e 73 69 64 65 20 74 | doSave |inside t|
|00000e30| 68 65 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |he. | |
|00000e40| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2f 20 20 | | // |
|00000e50| 77 69 6e 64 6f 77 20 64 | 65 66 69 6e 69 74 69 6f |window d|efinitio|
|00000e60| 6e 20 62 65 63 61 75 73 | 65 20 74 68 65 79 20 61 |n becaus|e they a|
|00000e70| 72 65 20 64 69 72 65 63 | 74 65 64 20 61 74 0d 20 |re direc|ted at. |
|00000e80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000e90| 20 20 20 20 20 20 20 20 | 2f 2f 20 20 61 20 70 61 | |// a pa|
|00000ea0| 72 74 69 63 75 6c 61 72 | 20 77 69 6e 64 6f 77 2e |rticular| window.|
|00000eb0| 20 20 54 68 65 20 63 6f | 6d 6d 61 6e 64 73 20 4e | The co|mmands N|
|00000ec0| 65 77 20 61 6e 64 0d 20 | 20 20 20 20 20 20 20 20 |ew and. | |
|00000ed0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ee0| 2f 2f 20 20 4f 70 65 6e | 20 61 72 65 20 6e 6f 74 |// Open| are not|
|00000ef0| 20 64 69 72 65 63 74 65 | 64 20 74 6f 20 61 20 70 | directe|d to a p|
|00000f00| 61 72 74 69 63 75 6c 61 | 72 20 77 69 6e 64 6f 77 |articula|r window|
|00000f10| 2c 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |,. | |
|00000f20| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2f 20 20 73 | | // s|
|00000f30| 6f 20 74 68 65 69 72 20 | 68 61 6e 64 6c 65 72 73 |o their |handlers|
|00000f40| 20 61 72 65 20 6e 6f 74 | 20 70 61 72 74 20 6f 66 | are not| part of|
|00000f50| 20 74 68 65 20 77 69 6e | 64 6f 77 0d 20 20 20 20 | the win|dow. |
|00000f60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000f70| 20 20 20 20 20 2f 2f 20 | 20 64 65 66 69 6e 69 74 | // | definit|
|00000f80| 69 6f 6e 2e 29 0d 0d 20 | 20 20 76 6f 69 64 20 50 |ion.).. | void P|
|00000f90| 75 74 4c 69 6e 65 53 65 | 67 6d 65 6e 74 28 50 6f |utLineSe|gment(Po|
|00000fa0| 69 6e 74 20 70 74 31 2c | 20 50 6f 69 6e 74 20 70 |int pt1,| Point p|
|00000fb0| 74 32 29 3b 0d 20 20 20 | 20 20 20 20 20 20 20 20 |t2);. | |
|00000fc0| 20 20 20 20 20 20 20 20 | 20 2f 2f 20 44 72 61 77 | | // Draw|
|00000fd0| 73 20 61 20 6c 69 6e 65 | 20 66 72 6f 6d 20 70 74 |s a line| from pt|
|00000fe0| 31 20 74 6f 20 70 74 32 | 20 61 6c 6f 6e 67 20 77 |1 to pt2| along w|
|00000ff0| 69 74 68 20 74 68 65 20 | 73 65 76 65 6e 0d 20 20 |ith the |seven. |
|00001000| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001010| 20 20 2f 2f 20 70 6f 73 | 73 69 62 6c 65 20 22 72 | // pos|sible "r|
|00001020| 65 66 6c 65 63 74 69 6f | 6e 73 22 20 6f 66 20 74 |eflectio|ns" of t|
|00001030| 68 65 20 6c 69 6e 65 2e | 0d 20 20 20 0d 20 20 20 |he line.|. . |
|00001040| 76 69 72 74 75 61 6c 20 | 76 6f 69 64 20 4f 70 65 |virtual |void Ope|
|00001050| 6e 49 6e 52 65 63 74 28 | 53 74 72 32 35 35 20 74 |nInRect(|Str255 t|
|00001060| 69 74 6c 65 2c 20 69 6e | 74 20 6c 65 66 74 2c 20 |itle, in|t left, |
|00001070| 69 6e 74 20 74 6f 70 2c | 20 69 6e 74 20 72 69 67 |int top,| int rig|
|00001080| 68 74 2c 20 69 6e 74 20 | 62 6f 74 74 6f 6d 29 3b |ht, int |bottom);|
|00001090| 20 20 20 0d 20 20 20 76 | 69 72 74 75 61 6c 20 73 | . v|irtual s|
|000010a0| 68 6f 72 74 20 43 6c 6f | 73 65 28 76 6f 69 64 29 |hort Clo|se(void)|
|000010b0| 3b 0d 0d 20 20 20 76 69 | 72 74 75 61 6c 20 76 6f |;.. vi|rtual vo|
|000010c0| 69 64 20 61 64 6a 75 73 | 74 54 6f 4e 65 77 53 69 |id adjus|tToNewSi|
|000010d0| 7a 65 28 76 6f 69 64 29 | 3b 0d 20 20 20 76 69 72 |ze(void)|;. vir|
|000010e0| 74 75 61 6c 20 76 6f 69 | 64 20 53 65 74 44 65 66 |tual voi|d SetDef|
|000010f0| 61 75 6c 74 73 28 76 6f | 69 64 29 3b 0d 20 20 20 |aults(vo|id);. |
|00001100| 76 69 72 74 75 61 6c 20 | 76 6f 69 64 20 64 6f 4b |virtual |void doK|
|00001110| 65 79 28 63 68 61 72 20 | 63 68 29 3b 0d 20 20 20 |ey(char |ch);. |
|00001120| 76 69 72 74 75 61 6c 20 | 76 6f 69 64 20 64 6f 43 |virtual |void doC|
|00001130| 6f 6e 74 65 6e 74 43 6c | 69 63 6b 28 50 6f 69 6e |ontentCl|ick(Poin|
|00001140| 74 20 6c 6f 63 61 6c 50 | 74 29 3b 0d 20 20 20 76 |t localP|t);. v|
|00001150| 69 72 74 75 61 6c 20 76 | 6f 69 64 20 64 6f 52 65 |irtual v|oid doRe|
|00001160| 64 72 61 77 28 52 65 63 | 74 2a 20 62 61 64 52 65 |draw(Rec|t* badRe|
|00001170| 63 74 29 3b 0d 20 20 20 | 76 69 72 74 75 61 6c 20 |ct);. |virtual |
|00001180| 76 6f 69 64 20 64 6f 48 | 53 63 72 6f 6c 6c 28 69 |void doH|Scroll(i|
|00001190| 6e 74 20 64 68 29 3b 0d | 20 20 20 76 69 72 74 75 |nt dh);.| virtu|
|000011a0| 61 6c 20 76 6f 69 64 20 | 64 6f 56 53 63 72 6f 6c |al void |doVScrol|
|000011b0| 6c 28 69 6e 74 20 64 76 | 29 3b 0d 20 20 20 76 69 |l(int dv|);. vi|
|000011c0| 72 74 75 61 6c 20 76 6f | 69 64 20 64 6f 41 63 74 |rtual vo|id doAct|
|000011d0| 69 76 61 74 65 28 69 6e | 74 20 61 63 74 69 76 65 |ivate(in|t active|
|000011e0| 29 3b 0d 20 20 20 0d 7d | 3b 0d 0d 0d 2f 2f 20 46 |);. .}|;...// F|
|000011f0| 75 6e 63 74 69 6f 6e 20 | 64 6f 43 6c 65 61 72 20 |unction |doClear |
|00001200| 69 73 20 63 61 6c 6c 65 | 64 20 69 6e 20 72 65 73 |is calle|d in res|
|00001210| 70 6f 6e 73 65 20 74 6f | 20 61 20 43 6c 65 61 72 |ponse to| a Clear|
|00001220| 20 63 6f 6d 6d 61 6e 64 | 20 66 72 6f 6d 20 74 68 | command| from th|
|00001230| 65 20 0d 2f 2f 20 65 64 | 69 74 20 6d 65 6e 75 2e |e .// ed|it menu.|
|00001240| 20 20 49 74 20 6a 75 73 | 74 20 63 6c 65 61 72 73 | It jus|t clears|
|00001250| 20 74 68 65 20 77 69 6e | 64 6f 77 20 62 79 20 64 | the win|dow by d|
|00001260| 65 63 6c 61 72 69 6e 67 | 20 74 68 61 74 20 74 68 |eclaring| that th|
|00001270| 65 72 65 20 61 72 65 20 | 6e 6f 0d 2f 2f 20 70 6f |ere are |no.// po|
|00001280| 69 6e 74 73 20 66 6f 72 | 20 74 68 65 20 77 69 6e |ints for| the win|
|00001290| 64 6f 77 2e 20 20 4e 4f | 54 45 20 74 68 65 20 75 |dow. NO|TE the u|
|000012a0| 73 65 20 6f 66 20 46 6f | 72 63 65 52 65 64 72 61 |se of Fo|rceRedra|
|000012b0| 77 28 30 29 2c 20 77 68 | 69 63 68 20 63 61 75 73 |w(0), wh|ich caus|
|000012c0| 65 73 20 74 68 65 0d 2f | 2f 20 77 69 6e 64 6f 77 |es the./|/ window|
|000012d0| 20 74 6f 20 62 65 20 65 | 72 61 73 65 64 20 61 6e | to be e|rased an|
|000012e0| 64 20 72 65 64 72 61 77 | 6e 20 62 79 20 74 68 65 |d redraw|n by the|
|000012f0| 20 66 75 6e 63 74 69 6f | 6e 73 20 77 69 74 68 20 | functio|ns with |
|00001300| 74 68 6f 73 65 20 73 70 | 65 63 69 66 69 63 0d 2f |those sp|ecific./|
|00001310| 2f 20 6a 6f 62 73 2e 20 | 20 54 68 69 73 20 69 73 |/ jobs. | This is|
|00001320| 20 67 65 6e 65 72 61 6c | 6c 79 20 70 72 65 66 65 | general|ly prefe|
|00001330| 72 61 62 6c 65 20 74 6f | 20 64 6f 69 6e 67 20 74 |rable to| doing t|
|00001340| 68 65 20 72 65 64 72 61 | 77 69 6e 67 20 22 69 6e |he redra|wing "in|
|00001350| 20 70 6c 61 63 65 22 2c | 0d 2f 2f 20 73 69 6e 63 | place",|.// sinc|
|00001360| 65 20 74 68 61 74 20 63 | 61 6e 20 6c 65 61 64 20 |e that c|an lead |
|00001370| 74 6f 20 75 6e 6e 65 63 | 65 73 73 61 72 79 20 63 |to unnec|essary c|
|00001380| 6f 64 65 20 64 75 70 6c | 69 63 61 74 69 6f 6e 2e |ode dupl|ication.|
|00001390| 0d 0d 76 6f 69 64 20 6d | 79 57 69 6e 64 6f 77 3a |..void m|yWindow:|
|000013a0| 3a 64 6f 43 6c 65 61 72 | 28 76 6f 69 64 29 20 7b |:doClear|(void) {|
|000013b0| 0d 20 20 20 70 74 43 6f | 75 6e 74 20 3d 20 30 3b |. ptCo|unt = 0;|
|000013c0| 0d 20 20 20 61 6c 6c 46 | 69 6c 6c 65 64 55 70 20 |. allF|illedUp |
|000013d0| 3d 20 30 3b 0d 20 20 20 | 46 6f 72 63 65 52 65 64 |= 0;. |ForceRed|
|000013e0| 72 61 77 28 30 29 3b 0d | 7d 0d 0d 0d 2f 2f 20 46 |raw(0);.|}...// F|
|000013f0| 75 6e 63 74 69 6f 6e 20 | 64 6f 53 61 76 65 20 69 |unction |doSave i|
|00001400| 73 20 63 61 6c 6c 65 64 | 20 69 6e 20 72 65 73 70 |s called| in resp|
|00001410| 6f 6e 73 65 20 74 6f 20 | 74 68 65 20 53 61 76 65 |onse to |the Save|
|00001420| 20 63 6f 6d 6d 61 6e 64 | 20 66 72 6f 6d 20 74 68 | command| from th|
|00001430| 65 0d 2f 2f 20 66 69 6c | 65 20 6d 65 6e 75 2e 20 |e.// fil|e menu. |
|00001440| 20 49 74 20 75 73 65 73 | 20 66 75 6e 63 74 69 6f | It uses| functio|
|00001450| 6e 20 4f 70 65 6e 4e 65 | 77 46 69 6c 65 20 28 64 |n OpenNe|wFile (d|
|00001460| 65 66 69 6e 65 64 20 69 | 6e 20 69 6e 70 75 74 42 |efined i|n inputB|
|00001470| 6f 78 65 73 2e 63 29 0d | 2f 2f 20 74 6f 20 73 65 |oxes.c).|// to se|
|00001480| 6c 65 63 74 20 74 68 65 | 20 6e 65 77 20 66 69 6c |lect the| new fil|
|00001490| 65 27 73 20 6e 61 6d 65 | 20 61 6e 64 20 66 6f 6c |e's name| and fol|
|000014a0| 64 65 72 20 75 73 69 6e | 67 20 61 20 73 74 61 6e |der usin|g a stan|
|000014b0| 64 61 72 64 20 4d 61 63 | 20 6e 65 77 20 66 69 6c |dard Mac| new fil|
|000014c0| 65 20 0d 2f 2f 20 64 69 | 61 6c 6f 67 2e 20 20 28 |e .// di|alog. (|
|000014d0| 49 20 73 68 6f 75 6c 64 | 20 70 72 6f 62 61 62 6c |I should| probabl|
|000014e0| 79 20 64 6f 20 6d 6f 72 | 65 20 65 72 72 6f 72 20 |y do mor|e error |
|000014f0| 63 68 65 63 6b 69 6e 67 | 20 68 65 72 65 20 62 75 |checking| here bu|
|00001500| 74 20 69 6e 20 66 61 63 | 74 2c 0d 2f 2f 20 61 6e |t in fac|t,.// an|
|00001510| 20 65 72 72 6f 72 20 69 | 73 20 75 6e 6c 69 6b 65 | error i|s unlike|
|00001520| 6c 79 2e 29 0d 0d 76 6f | 69 64 20 6d 79 57 69 6e |ly.)..vo|id myWin|
|00001530| 64 6f 77 3a 3a 64 6f 53 | 61 76 65 28 76 6f 69 64 |dow::doS|ave(void|
|00001540| 29 20 7b 0d 20 20 20 46 | 49 4c 45 20 2a 66 69 6c |) {. F|ILE *fil|
|00001550| 65 3b 0d 20 20 20 53 74 | 72 32 35 35 20 74 69 74 |e;. St|r255 tit|
|00001560| 6c 65 3b 0d 20 20 20 73 | 68 6f 72 74 20 69 3b 0d |le;. s|hort i;.|
|00001570| 20 20 20 47 65 74 54 69 | 74 6c 65 28 74 69 74 6c | GetTi|tle(titl|
|00001580| 65 29 3b 0d 20 20 20 69 | 66 20 28 20 66 69 6c 65 |e);. i|f ( file|
|00001590| 20 3d 20 4f 70 65 6e 4e | 65 77 46 69 6c 65 28 22 | = OpenN|ewFile("|
|000015a0| 5c 70 53 61 76 65 20 73 | 6b 65 74 63 68 20 69 6e |\pSave s|ketch in|
|000015b0| 3a 22 2c 74 69 74 6c 65 | 29 20 29 20 7b 0d 20 20 |:",title|) ) {. |
|000015c0| 20 20 20 20 53 65 74 54 | 69 74 6c 65 28 74 69 74 | SetT|itle(tit|
|000015d0| 6c 65 29 3b 0d 20 20 20 | 20 20 20 66 70 72 69 6e |le);. | fprin|
|000015e0| 74 66 28 66 69 6c 65 2c | 20 22 25 68 64 20 25 68 |tf(file,| "%hd %h|
|000015f0| 64 20 25 68 64 5c 6e 22 | 2c 20 77 69 6e 57 69 64 |d %hd\n"|, winWid|
|00001600| 74 68 2c 20 77 69 6e 48 | 65 69 67 68 74 2c 20 70 |th, winH|eight, p|
|00001610| 74 43 6f 75 6e 74 29 3b | 0d 20 20 20 20 20 20 66 |tCount);|. f|
|00001620| 6f 72 20 28 69 3d 30 3b | 20 69 3c 70 74 43 6f 75 |or (i=0;| i<ptCou|
|00001630| 6e 74 3b 20 69 2b 2b 29 | 0d 20 20 20 20 20 20 20 |nt; i++)|. |
|00001640| 20 20 66 70 72 69 6e 74 | 66 28 66 69 6c 65 2c 20 | fprint|f(file, |
|00001650| 22 25 68 64 20 25 68 64 | 5c 6e 22 2c 20 70 74 5b |"%hd %hd|\n", pt[|
|00001660| 69 5d 2e 68 2c 20 70 74 | 5b 69 5d 2e 76 29 3b 0d |i].h, pt|[i].v);.|
|00001670| 20 20 20 20 20 20 66 63 | 6c 6f 73 65 28 66 69 6c | fc|lose(fil|
|00001680| 65 29 3b 0d 20 20 20 7d | 3b 0d 7d 0d 0d 0d 2f 2f |e);. }|;.}...//|
|00001690| 20 46 75 6e 63 74 69 6f | 6e 20 64 6f 4f 70 65 6e | Functio|n doOpen|
|000016a0| 20 69 73 20 63 61 6c 6c | 65 64 20 69 6e 20 72 65 | is call|ed in re|
|000016b0| 73 70 6f 6e 73 65 20 74 | 6f 20 74 68 65 20 53 61 |sponse t|o the Sa|
|000016c0| 76 65 20 63 6f 6d 6d 61 | 6e 64 20 66 72 6f 6d 20 |ve comma|nd from |
|000016d0| 74 68 65 0d 2f 2f 20 66 | 69 6c 65 20 6d 65 6e 75 |the.// f|ile menu|
|000016e0| 2e 20 20 49 74 20 75 73 | 65 64 20 66 75 6e 63 74 |. It us|ed funct|
|000016f0| 69 6f 6e 20 4f 70 65 6e | 4f 6c 64 46 69 6c 65 20 |ion Open|OldFile |
|00001700| 28 64 65 66 69 6e 65 64 | 20 69 6e 20 69 6e 70 75 |(defined| in inpu|
|00001710| 74 42 6f 78 65 73 2e 63 | 29 0d 2f 2f 20 74 6f 20 |tBoxes.c|).// to |
|00001720| 61 6c 6c 6f 77 20 74 68 | 65 20 75 73 65 72 20 74 |allow th|e user t|
|00001730| 6f 20 73 70 65 63 69 66 | 79 20 74 68 65 20 66 69 |o specif|y the fi|
|00001740| 6c 65 20 74 6f 20 62 65 | 20 72 65 61 64 2e 20 0d |le to be| read. .|
|00001750| 2f 2f 20 49 20 64 6f 20 | 61 20 66 61 69 72 20 61 |// I do |a fair a|
|00001760| 6d 6f 75 6e 74 20 6f 66 | 20 65 72 72 6f 72 2d 63 |mount of| error-c|
|00001770| 68 65 63 6b 69 6e 67 20 | 68 65 72 65 20 62 65 63 |hecking |here bec|
|00001780| 61 75 73 65 20 69 74 20 | 69 73 20 70 6f 73 73 69 |ause it |is possi|
|00001790| 62 6c 65 0d 2f 2f 20 66 | 6f 72 20 74 68 65 20 75 |ble.// f|or the u|
|000017a0| 73 65 72 20 74 6f 20 73 | 65 6c 65 63 74 20 61 6e |ser to s|elect an|
|000017b0| 79 20 74 65 78 74 20 66 | 69 6c 65 2c 20 61 6e 64 |y text f|ile, and|
|000017c0| 20 69 66 20 74 68 65 20 | 66 69 6c 65 20 69 73 20 | if the |file is |
|000017d0| 6e 6f 74 20 6f 6e 65 0d | 2f 2f 20 70 72 6f 64 75 |not one.|// produ|
|000017e0| 63 65 64 20 70 72 65 76 | 69 6f 75 73 6c 79 20 62 |ced prev|iously b|
|000017f0| 79 20 74 68 69 73 20 70 | 72 6f 67 72 61 6d 2c 20 |y this p|rogram, |
|00001800| 69 74 20 77 69 6c 6c 20 | 61 6c 6d 6f 73 74 20 63 |it will |almost c|
|00001810| 65 72 74 61 69 6e 6c 79 | 20 67 65 6e 65 72 61 74 |ertainly| generat|
|00001820| 65 0d 2f 2f 20 61 6e 20 | 65 72 72 6f 72 2e 0d 0d |e.// an |error...|
|00001830| 76 6f 69 64 20 64 6f 4f | 70 65 6e 28 76 6f 69 64 |void doO|pen(void|
|00001840| 29 20 7b 0d 20 20 20 46 | 49 4c 45 20 2a 66 69 6c |) {. F|ILE *fil|
|00001850| 65 3b 0d 20 20 20 53 74 | 72 32 35 35 20 74 69 74 |e;. St|r255 tit|
|00001860| 6c 65 3b 0d 20 20 20 73 | 68 6f 72 74 20 77 69 64 |le;. s|hort wid|
|00001870| 74 68 2c 68 65 69 67 68 | 74 2c 70 74 43 74 3b 0d |th,heigh|t,ptCt;.|
|00001880| 20 20 20 73 68 6f 72 74 | 20 68 2c 76 3b 0d 20 20 | short| h,v;. |
|00001890| 20 73 68 6f 72 74 20 69 | 3b 0d 20 20 20 6d 79 57 | short i|;. myW|
|000018a0| 69 6e 64 6f 77 20 2a 77 | 69 6e 3b 0d 20 20 20 69 |indow *w|in;. i|
|000018b0| 66 20 28 20 66 69 6c 65 | 20 3d 20 4f 70 65 6e 4f |f ( file| = OpenO|
|000018c0| 6c 64 46 69 6c 65 28 74 | 69 74 6c 65 29 20 29 20 |ldFile(t|itle) ) |
|000018d0| 7b 0d 20 20 20 20 20 20 | 77 69 6e 20 3d 20 6e 65 |{. |win = ne|
|000018e0| 77 20 6d 79 57 69 6e 64 | 6f 77 3b 0d 20 20 20 20 |w myWind|ow;. |
|000018f0| 20 20 77 69 6e 2d 3e 4f | 70 65 6e 28 74 69 74 6c | win->O|pen(titl|
|00001900| 65 29 3b 20 20 2f 2f 20 | 6e 6f 74 65 20 74 68 61 |e); // |note tha|
|00001910| 74 20 74 68 65 20 77 69 | 6e 64 6f 77 20 74 69 74 |t the wi|ndow tit|
|00001920| 6c 65 20 69 73 20 74 68 | 65 20 66 69 6c 65 20 6e |le is th|e file n|
|00001930| 61 6d 65 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ame. | |
|00001940| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 | | // |
|00001950| 74 68 61 74 20 69 73 20 | 72 65 74 75 72 6e 65 64 |that is |returned|
|00001960| 20 62 79 20 4f 70 65 6e | 4f 6c 64 46 69 6c 65 0d | by Open|OldFile.|
|00001970| 20 20 20 20 20 20 69 66 | 20 28 66 73 63 61 6e 66 | if| (fscanf|
|00001980| 28 66 69 6c 65 2c 22 25 | 68 64 20 25 68 64 20 25 |(file,"%|hd %hd %|
|00001990| 68 64 5c 6e 22 2c 20 26 | 77 69 64 74 68 2c 20 26 |hd\n", &|width, &|
|000019a0| 68 65 69 67 68 74 2c 20 | 26 70 74 43 74 29 20 21 |height, |&ptCt) !|
|000019b0| 3d 20 33 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |= 3. | |
|000019c0| 7c 7c 20 77 69 64 74 68 | 20 3c 3d 20 30 20 7c 7c ||| width| <= 0 |||
|000019d0| 20 68 65 69 67 68 74 20 | 3c 20 30 20 7c 7c 20 70 | height |< 0 || p|
|000019e0| 74 43 74 20 3e 20 6d 61 | 78 50 6f 69 6e 74 73 29 |tCt > ma|xPoints)|
|000019f0| 20 7b 0d 20 20 20 20 20 | 20 20 20 20 54 65 6c 6c | {. | Tell|
|00001a00| 55 73 65 72 28 22 5c 70 | 53 6f 72 72 79 2c 20 61 |User("\p|Sorry, a|
|00001a10| 6e 20 65 72 72 6f 72 20 | 6f 63 63 75 72 65 64 20 |n error |occured |
|00001a20| 77 68 69 6c 65 20 74 72 | 79 69 6e 67 20 74 6f 20 |while tr|ying to |
|00001a30| 72 65 61 64 20 66 72 6f | 6d 20 74 68 65 20 66 69 |read fro|m the fi|
|00001a40| 6c 65 2e 22 29 3b 0d 20 | 20 20 20 20 20 20 20 20 |le.");. | |
|00001a50| 77 69 6e 2d 3e 43 6c 6f | 73 65 28 29 3b 0d 20 20 |win->Clo|se();. |
|00001a60| 20 20 20 20 20 20 20 66 | 63 6c 6f 73 65 28 66 69 | f|close(fi|
|00001a70| 6c 65 29 3b 0d 20 20 20 | 20 20 20 20 20 20 72 65 |le);. | re|
|00001a80| 74 75 72 6e 3b 0d 20 20 | 20 20 20 20 7d 0d 20 20 |turn;. | }. |
|00001a90| 20 20 20 20 65 6c 73 65 | 20 7b 0d 20 20 20 20 20 | else| {. |
|00001aa0| 20 20 20 20 77 69 6e 2d | 3e 77 69 6e 48 65 69 67 | win-|>winHeig|
|00001ab0| 68 74 20 3d 20 68 65 69 | 67 68 74 3b 0d 20 20 20 |ht = hei|ght;. |
|00001ac0| 20 20 20 20 20 20 77 69 | 6e 2d 3e 77 69 6e 57 69 | wi|n->winWi|
|00001ad0| 64 74 68 20 3d 20 77 69 | 64 74 68 3b 0d 20 20 20 |dth = wi|dth;. |
|00001ae0| 20 20 20 20 20 20 77 69 | 6e 2d 3e 70 74 43 6f 75 | wi|n->ptCou|
|00001af0| 6e 74 20 3d 20 70 74 43 | 74 3b 0d 20 20 20 20 20 |nt = ptC|t;. |
|00001b00| 20 7d 3b 0d 20 20 20 20 | 20 20 66 6f 72 20 28 69 | };. | for (i|
|00001b10| 3d 30 3b 20 69 3c 77 69 | 6e 2d 3e 70 74 43 6f 75 |=0; i<wi|n->ptCou|
|00001b20| 6e 74 3b 20 69 2b 2b 29 | 20 7b 0d 20 20 20 20 20 |nt; i++)| {. |
|00001b30| 20 20 20 69 66 20 28 66 | 73 63 61 6e 66 28 66 69 | if (f|scanf(fi|
|00001b40| 6c 65 2c 20 22 25 68 64 | 20 25 68 64 5c 6e 22 2c |le, "%hd| %hd\n",|
|00001b50| 20 26 68 2c 20 26 76 29 | 20 21 3d 20 32 0d 20 20 | &h, &v)| != 2. |
|00001b60| 20 20 20 20 20 20 20 20 | 20 20 20 7c 7c 20 68 20 | | || h |
|00001b70| 3c 20 2d 31 20 7c 7c 20 | 76 20 3c 20 30 20 7c 7c |< -1 || |v < 0 |||
|00001b80| 20 76 3e 68 65 69 67 68 | 74 20 7c 7c 20 68 3e 77 | v>heigh|t || h>w|
|00001b90| 69 64 74 68 20 29 20 7b | 0d 20 20 20 20 20 20 20 |idth ) {|. |
|00001ba0| 20 20 20 20 54 65 6c 6c | 55 73 65 72 28 22 5c 70 | Tell|User("\p|
|00001bb0| 53 6f 72 72 79 2c 20 69 | 6c 6c 65 67 61 6c 20 64 |Sorry, i|llegal d|
|00001bc0| 61 74 61 20 6f 72 20 65 | 6e 64 2d 6f 66 2d 66 69 |ata or e|nd-of-fi|
|00001bd0| 6c 65 20 65 6e 63 6f 75 | 6e 74 65 72 65 64 20 77 |le encou|ntered w|
|00001be0| 68 69 6c 65 20 74 72 79 | 69 6e 67 20 74 6f 20 72 |hile try|ing to r|
|00001bf0| 65 61 64 20 66 72 6f 6d | 20 74 68 65 20 66 69 6c |ead from| the fil|
|00001c00| 65 2e 22 29 3b 0d 20 20 | 20 20 20 20 20 20 20 20 |e.");. | |
|00001c10| 20 77 69 6e 2d 3e 43 6c | 6f 73 65 28 29 3b 0d 20 | win->Cl|ose();. |
|00001c20| 20 20 20 20 20 20 20 20 | 20 20 66 63 6c 6f 73 65 | | fclose|
|00001c30| 28 66 69 6c 65 29 3b 0d | 20 20 20 20 20 20 20 20 |(file);.| |
|00001c40| 20 20 20 72 65 74 75 72 | 6e 3b 0d 20 20 20 20 20 | retur|n;. |
|00001c50| 20 20 20 7d 0d 20 20 20 | 20 20 20 20 20 65 6c 73 | }. | els|
|00001c60| 65 20 7b 0d 20 20 20 20 | 20 20 20 20 20 20 20 77 |e {. | w|
|00001c70| 69 6e 2d 3e 70 74 5b 69 | 5d 2e 68 20 3d 20 68 3b |in->pt[i|].h = h;|
|00001c80| 0d 20 20 20 20 20 20 20 | 20 20 20 20 77 69 6e 2d |. | win-|
|00001c90| 3e 70 74 5b 69 5d 2e 76 | 20 3d 20 76 3b 0d 20 20 |>pt[i].v| = v;. |
|00001ca0| 20 20 20 20 20 20 7d 0d | 20 20 20 20 20 20 7d 3b | }.| };|
|00001cb0| 0d 20 20 20 20 20 20 66 | 63 6c 6f 73 65 28 66 69 |. f|close(fi|
|00001cc0| 6c 65 29 3b 0d 20 20 20 | 20 20 20 77 69 6e 2d 3e |le);. | win->|
|00001cd0| 61 64 6a 75 73 74 54 6f | 4e 65 77 53 69 7a 65 28 |adjustTo|NewSize(|
|00001ce0| 29 3b 0d 20 20 20 7d 0d | 7d 0d 0d 76 6f 69 64 20 |);. }.|}..void |
|00001cf0| 6d 79 57 69 6e 64 6f 77 | 3a 3a 53 65 74 44 65 66 |myWindow|::SetDef|
|00001d00| 61 75 6c 74 73 28 76 6f | 69 64 29 20 7b 0d 20 20 |aults(vo|id) {. |
|00001d10| 20 69 6e 68 65 72 69 74 | 65 64 3a 3a 53 65 74 44 | inherit|ed::SetD|
|00001d20| 65 66 61 75 6c 74 73 28 | 29 3b 0d 20 20 20 0d 20 |efaults(|);. . |
|00001d30| 20 20 66 65 61 74 75 72 | 65 73 20 3d 20 68 61 73 | featur|es = has|
|00001d40| 47 6f 41 77 61 79 20 2b | 20 68 61 73 5a 6f 6f 6d |GoAway +| hasZoom|
|00001d50| 20 2b 20 68 61 73 47 72 | 6f 77 3b 20 20 2f 2f 20 | + hasGr|ow; // |
|00001d60| 6d 6f 64 69 66 79 20 74 | 68 65 20 66 65 61 74 75 |modify t|he featu|
|00001d70| 72 65 20 6c 69 73 74 3b | 0d 20 20 20 20 20 20 20 |re list;|. |
|00001d80| 20 20 20 2f 2f 20 49 20 | 64 6f 6e 27 74 20 77 61 | // I |don't wa|
|00001d90| 6e 74 20 61 6e 79 20 73 | 63 72 6f 6c 6c 20 62 61 |nt any s|croll ba|
|00001da0| 72 73 2c 20 62 75 74 20 | 49 20 64 6f 20 77 61 6e |rs, but |I do wan|
|00001db0| 74 20 61 20 63 6c 6f 73 | 65 20 62 6f 78 2c 0d 20 |t a clos|e box,. |
|00001dc0| 20 20 20 20 20 20 20 20 | 20 2f 2f 20 7a 6f 6f 6d | | // zoom|
|00001dd0| 20 62 6f 78 20 61 6e 64 | 20 67 72 6f 77 20 62 6f | box and| grow bo|
|00001de0| 78 0d 20 20 20 0d 20 20 | 20 70 74 43 6f 75 6e 74 |x. . | ptCount|
|00001df0| 20 3d 20 30 3b 20 20 20 | 20 20 2f 2f 20 69 6e 69 | = 0; | // ini|
|00001e00| 74 69 61 6c 69 7a 65 20 | 77 69 6e 64 6f 77 20 64 |tialize |window d|
|00001e10| 61 74 61 3b 20 74 68 65 | 72 65 20 61 72 65 20 69 |ata; the|re are i|
|00001e20| 6e 69 74 69 61 6c 6c 79 | 20 6e 6f 20 70 6f 69 6e |nitially| no poin|
|00001e30| 74 73 0d 20 20 20 61 6c | 6c 46 69 6c 6c 65 64 55 |ts. al|lFilledU|
|00001e40| 70 20 3d 20 30 3b 20 2f | 2f 20 61 6e 64 20 74 68 |p = 0; /|/ and th|
|00001e50| 65 20 77 69 6e 64 6f 77 | 20 69 73 20 4e 4f 54 20 |e window| is NOT |
|00001e60| 61 6c 6c 46 69 6c 6c 65 | 64 55 70 2e 20 0d 20 20 |allFille|dUp. . |
|00001e70| 20 0d 20 20 20 6d 69 6e | 48 20 3d 20 31 30 30 3b | . min|H = 100;|
|00001e80| 20 20 2f 2f 20 73 65 74 | 20 6d 69 6e 69 6d 75 6d | // set| minimum|
|00001e90| 20 77 69 6e 64 6f 77 20 | 73 69 7a 65 20 77 68 65 | window |size whe|
|00001ea0| 6e 20 75 73 65 72 20 64 | 72 61 67 73 20 22 67 72 |n user d|rags "gr|
|00001eb0| 6f 77 20 62 6f 78 22 0d | 20 20 20 6d 69 6e 56 20 |ow box".| minV |
|00001ec0| 3d 20 31 30 30 3b 0d 7d | 0d 0d 76 6f 69 64 20 6d |= 100;.}|..void m|
|00001ed0| 79 57 69 6e 64 6f 77 3a | 3a 4f 70 65 6e 49 6e 52 |yWindow:|:OpenInR|
|00001ee0| 65 63 74 28 53 74 72 32 | 35 35 20 74 69 74 6c 65 |ect(Str2|55 title|
|00001ef0| 2c 20 69 6e 74 20 6c 65 | 66 74 2c 20 69 6e 74 20 |, int le|ft, int |
|00001f00| 74 6f 70 2c 20 69 6e 74 | 20 72 69 67 68 74 2c 20 |top, int| right, |
|00001f10| 69 6e 74 20 62 6f 74 74 | 6f 6d 29 20 7b 0d 20 20 |int bott|om) {. |
|00001f20| 20 69 6e 68 65 72 69 74 | 65 64 3a 3a 4f 70 65 6e | inherit|ed::Open|
|00001f30| 49 6e 52 65 63 74 28 74 | 69 74 6c 65 2c 6c 65 66 |InRect(t|itle,lef|
|00001f40| 74 2c 74 6f 70 2c 72 69 | 67 68 74 2c 62 6f 74 74 |t,top,ri|ght,bott|
|00001f50| 6f 6d 29 3b 0d 7d 0d 0d | 73 68 6f 72 74 20 6d 79 |om);.}..|short my|
|00001f60| 57 69 6e 64 6f 77 3a 3a | 43 6c 6f 73 65 28 76 6f |Window::|Close(vo|
|00001f70| 69 64 29 20 7b 0d 20 20 | 20 69 6e 68 65 72 69 74 |id) {. | inherit|
|00001f80| 65 64 3a 3a 43 6c 6f 73 | 65 28 29 3b 0d 7d 0d 0d |ed::Clos|e();.}..|
|00001f90| 76 6f 69 64 20 6d 79 57 | 69 6e 64 6f 77 3a 3a 64 |void myW|indow::d|
|00001fa0| 6f 4b 65 79 28 63 68 61 | 72 20 63 68 29 20 7b 0d |oKey(cha|r ch) {.|
|00001fb0| 7d 0d 0d 0d 2f 2f 20 46 | 75 6e 63 74 69 6f 6e 20 |}...// F|unction |
|00001fc0| 50 75 74 4c 69 6e 65 53 | 65 67 6d 65 6e 74 20 69 |PutLineS|egment i|
|00001fd0| 73 20 75 73 65 64 20 62 | 79 20 64 6f 52 65 64 72 |s used b|y doRedr|
|00001fe0| 61 77 20 61 6e 64 20 62 | 79 20 64 6f 43 6f 6e 74 |aw and b|y doCont|
|00001ff0| 65 6e 74 43 6c 69 63 6b | 20 74 6f 0d 2f 2f 20 64 |entClick| to.// d|
|00002000| 72 61 77 20 61 20 6c 69 | 6e 65 20 73 65 67 6d 65 |raw a li|ne segme|
|00002010| 6e 74 20 61 6e 64 20 69 | 74 73 20 73 65 76 65 6e |nt and i|ts seven|
|00002020| 20 70 6f 73 73 69 62 6c | 65 20 22 72 65 66 6c 65 | possibl|e "refle|
|00002030| 63 74 69 6f 6e 73 22 20 | 28 75 73 69 6e 67 20 68 |ctions" |(using h|
|00002040| 6f 72 69 7a 6f 6e 74 61 | 6c 2c 0d 2f 2f 20 76 65 |orizonta|l,.// ve|
|00002050| 72 74 69 63 61 6c 20 61 | 6e 64 20 64 69 61 67 6f |rtical a|nd diago|
|00002060| 6e 61 6c 20 72 65 66 6c | 65 63 74 69 6f 6e 29 2e |nal refl|ection).|
|00002070| 20 20 28 49 20 70 75 74 | 20 72 65 66 6c 65 63 74 | (I put| reflect|
|00002080| 69 6f 6e 73 20 69 6e 20 | 71 75 6f 74 65 73 20 73 |ions in |quotes s|
|00002090| 69 6e 63 65 0d 2f 2f 20 | 74 68 65 20 64 69 61 67 |ince.// |the diag|
|000020a0| 6f 6e 61 6c 20 22 72 65 | 66 6c 65 63 74 69 6f 6e |onal "re|flection|
|000020b0| 22 20 69 73 20 6e 6f 74 | 20 72 65 61 6c 6c 79 20 |" is not| really |
|000020c0| 61 20 74 72 75 65 20 72 | 65 66 6c 65 63 74 69 6f |a true r|eflectio|
|000020d0| 6e 20 69 66 20 74 68 65 | 20 77 69 6e 64 6f 77 0d |n if the| window.|
|000020e0| 2f 2f 20 69 73 20 6e 6f | 74 20 73 71 75 61 72 65 |// is no|t square|
|000020f0| 2e 29 20 20 54 68 69 73 | 20 66 75 6e 63 74 69 6f |.) This| functio|
|00002100| 6e 20 61 73 73 75 6d 65 | 73 20 74 68 61 74 20 74 |n assume|s that t|
|00002110| 68 65 20 64 72 61 77 69 | 6e 67 20 70 6f 72 74 20 |he drawi|ng port |
|00002120| 69 73 20 61 6c 72 65 61 | 64 79 0d 2f 2f 20 73 65 |is alrea|dy.// se|
|00002130| 74 20 74 6f 20 62 65 20 | 74 68 69 73 20 77 69 6e |t to be |this win|
|00002140| 64 6f 77 2e 0d 0d 76 6f | 69 64 20 6d 79 57 69 6e |dow...vo|id myWin|
|00002150| 64 6f 77 3a 3a 50 75 74 | 4c 69 6e 65 53 65 67 6d |dow::Put|LineSegm|
|00002160| 65 6e 74 28 50 6f 69 6e | 74 20 70 74 31 2c 20 50 |ent(Poin|t pt1, P|
|00002170| 6f 69 6e 74 20 70 74 32 | 29 20 7b 0d 20 20 20 73 |oint pt2|) {. s|
|00002180| 68 6f 72 74 20 61 2c 62 | 2c 78 2c 79 3b 0d 20 20 |hort a,b|,x,y;. |
|00002190| 20 0d 20 20 20 61 20 3d | 20 70 74 31 2e 68 3b 20 | . a =| pt1.h; |
|000021a0| 20 2f 2f 20 66 69 72 73 | 74 2c 20 70 6c 6f 74 20 | // firs|t, plot |
|000021b0| 74 68 65 20 6c 69 6e 65 | 20 69 74 73 65 6c 66 20 |the line| itself |
|000021c0| 61 6e 64 20 69 74 73 20 | 68 6f 72 69 7a 6f 6e 74 |and its |horizont|
|000021d0| 61 6c 2c 20 0d 20 20 20 | 62 20 3d 20 70 74 31 2e |al, . |b = pt1.|
|000021e0| 76 3b 20 20 2f 2f 20 76 | 65 72 74 69 63 61 6c 20 |v; // v|ertical |
|000021f0| 61 6e 64 20 63 6f 6d 62 | 69 6e 65 64 20 68 6f 72 |and comb|ined hor|
|00002200| 69 7a 6f 6e 74 61 6c 2f | 76 65 72 74 69 63 61 6c |izontal/|vertical|
|00002210| 20 72 65 66 6c 65 63 74 | 69 6f 6e 0d 20 20 20 78 | reflect|ion. x|
|00002220| 20 3d 20 70 74 32 2e 68 | 3b 0d 20 20 20 79 20 3d | = pt2.h|;. y =|
|00002230| 20 70 74 32 2e 76 3b 20 | 0d 20 20 20 4d 6f 76 65 | pt2.v; |. Move|
|00002240| 54 6f 28 61 2c 62 29 3b | 20 20 20 20 20 20 20 20 |To(a,b);| |
|00002250| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 4c 69 6e | | Lin|
|00002260| 65 54 6f 28 78 2c 79 29 | 3b 0d 20 20 20 4d 6f 76 |eTo(x,y)|;. Mov|
|00002270| 65 54 6f 28 77 69 6e 57 | 69 64 74 68 2d 61 2c 62 |eTo(winW|idth-a,b|
|00002280| 29 3b 20 20 20 20 20 20 | 20 20 20 20 20 20 4c 69 |); | Li|
|00002290| 6e 65 54 6f 28 77 69 6e | 57 69 64 74 68 2d 78 2c |neTo(win|Width-x,|
|000022a0| 79 29 3b 0d 20 20 20 4d | 6f 76 65 54 6f 28 77 69 |y);. M|oveTo(wi|
|000022b0| 6e 57 69 64 74 68 2d 61 | 2c 77 69 6e 48 65 69 67 |nWidth-a|,winHeig|
|000022c0| 68 74 2d 62 29 3b 20 20 | 4c 69 6e 65 54 6f 28 77 |ht-b); |LineTo(w|
|000022d0| 69 6e 57 69 64 74 68 2d | 78 2c 77 69 6e 48 65 69 |inWidth-|x,winHei|
|000022e0| 67 68 74 2d 79 29 3b 0d | 20 20 20 4d 6f 76 65 54 |ght-y);.| MoveT|
|000022f0| 6f 28 61 2c 77 69 6e 48 | 65 69 67 68 74 2d 62 29 |o(a,winH|eight-b)|
|00002300| 3b 20 20 20 20 20 20 20 | 20 20 20 20 4c 69 6e 65 |; | Line|
|00002310| 54 6f 28 78 2c 77 69 6e | 48 65 69 67 68 74 2d 79 |To(x,win|Height-y|
|00002320| 29 3b 0d 20 20 20 0d 20 | 20 20 61 20 3d 20 70 74 |);. . | a = pt|
|00002330| 31 2e 76 20 2a 20 28 28 | 64 6f 75 62 6c 65 29 20 |1.v * ((|double) |
|00002340| 77 69 6e 57 69 64 74 68 | 20 29 2f 20 77 69 6e 48 |winWidth| )/ winH|
|00002350| 65 69 67 68 74 3b 20 2f | 2f 20 6e 65 78 74 2c 20 |eight; /|/ next, |
|00002360| 63 6f 6d 70 75 74 65 20 | 74 68 65 20 64 69 61 67 |compute |the diag|
|00002370| 6f 6e 61 6c 0d 20 20 20 | 62 20 3d 20 70 74 31 2e |onal. |b = pt1.|
|00002380| 68 20 2a 20 28 28 64 6f | 75 62 6c 65 29 20 77 69 |h * ((do|uble) wi|
|00002390| 6e 48 65 69 67 68 74 20 | 29 2f 20 77 69 6e 57 69 |nHeight |)/ winWi|
|000023a0| 64 74 68 3b 20 2f 2f 20 | 22 72 65 66 6c 65 63 74 |dth; // |"reflect|
|000023b0| 69 6f 6e 22 20 6f 66 20 | 74 68 65 20 6f 72 69 67 |ion" of |the orig|
|000023c0| 69 6e 61 6c 0d 20 20 20 | 78 20 3d 20 70 74 32 2e |inal. |x = pt2.|
|000023d0| 76 20 2a 20 28 28 64 6f | 75 62 6c 65 29 20 77 69 |v * ((do|uble) wi|
|000023e0| 6e 57 69 64 74 68 20 29 | 2f 20 77 69 6e 48 65 69 |nWidth )|/ winHei|
|000023f0| 67 68 74 3b 20 2f 2f 20 | 6c 69 6e 65 20 61 6e 64 |ght; // |line and|
|00002400| 20 70 6c 6f 74 20 69 74 | 20 61 6e 64 20 69 74 73 | plot it| and its|
|00002410| 0d 20 20 20 79 20 3d 20 | 70 74 32 2e 68 20 2a 20 |. y = |pt2.h * |
|00002420| 28 28 64 6f 75 62 6c 65 | 29 20 77 69 6e 48 65 69 |((double|) winHei|
|00002430| 67 68 74 20 29 2f 20 77 | 69 6e 57 69 64 74 68 3b |ght )/ w|inWidth;|
|00002440| 20 2f 2f 20 72 65 66 6c | 65 63 74 69 6f 6e 73 0d | // refl|ections.|
|00002450| 20 20 20 4d 6f 76 65 54 | 6f 28 61 2c 62 29 3b 20 | MoveT|o(a,b); |
|00002460| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002470| 20 20 20 20 4c 69 6e 65 | 54 6f 28 78 2c 79 29 3b | Line|To(x,y);|
|00002480| 0d 20 20 20 4d 6f 76 65 | 54 6f 28 77 69 6e 57 69 |. Move|To(winWi|
|00002490| 64 74 68 2d 61 2c 62 29 | 3b 20 20 20 20 20 20 20 |dth-a,b)|; |
|000024a0| 20 20 20 20 20 4c 69 6e | 65 54 6f 28 77 69 6e 57 | Lin|eTo(winW|
|000024b0| 69 64 74 68 2d 78 2c 79 | 29 3b 0d 20 20 20 4d 6f |idth-x,y|);. Mo|
|000024c0| 76 65 54 6f 28 77 69 6e | 57 69 64 74 68 2d 61 2c |veTo(win|Width-a,|
|000024d0| 77 69 6e 48 65 69 67 68 | 74 2d 62 29 3b 20 20 4c |winHeigh|t-b); L|
|000024e0| 69 6e 65 54 6f 28 77 69 | 6e 57 69 64 74 68 2d 78 |ineTo(wi|nWidth-x|
|000024f0| 2c 77 69 6e 48 65 69 67 | 68 74 2d 79 29 3b 0d 20 |,winHeig|ht-y);. |
|00002500| 20 20 4d 6f 76 65 54 6f | 28 61 2c 77 69 6e 48 65 | MoveTo|(a,winHe|
|00002510| 69 67 68 74 2d 62 29 3b | 20 20 20 20 20 20 20 20 |ight-b);| |
|00002520| 20 20 20 4c 69 6e 65 54 | 6f 28 78 2c 77 69 6e 48 | LineT|o(x,winH|
|00002530| 65 69 67 68 74 2d 79 29 | 3b 0d 7d 0d 0d 0d 76 6f |eight-y)|;.}...vo|
|00002540| 69 64 20 6d 79 57 69 6e | 64 6f 77 3a 3a 64 6f 43 |id myWin|dow::doC|
|00002550| 6f 6e 74 65 6e 74 43 6c | 69 63 6b 28 50 6f 69 6e |ontentCl|ick(Poin|
|00002560| 74 20 6c 6f 63 61 6c 50 | 74 29 20 7b 0d 20 20 20 |t localP|t) {. |
|00002570| 50 6f 69 6e 74 20 6c 61 | 73 74 50 74 2c 20 6e 65 |Point la|stPt, ne|
|00002580| 78 74 50 74 3b 0d 20 20 | 20 73 68 6f 72 74 20 64 |xtPt;. | short d|
|00002590| 69 64 53 6f 6d 65 44 72 | 61 77 69 6e 67 3b 0d 20 |idSomeDr|awing;. |
|000025a0| 20 20 69 66 20 28 61 6c | 6c 46 69 6c 6c 65 64 55 | if (al|lFilledU|
|000025b0| 70 29 20 20 20 2f 2f 20 | 64 72 61 77 69 6e 67 20 |p) // |drawing |
|000025c0| 61 66 74 65 72 20 61 6c | 6c 46 69 6c 6c 65 64 55 |after al|lFilledU|
|000025d0| 70 20 69 73 20 6e 6f 74 | 20 61 6c 6c 6f 77 65 64 |p is not| allowed|
|000025e0| 0d 20 20 20 20 20 20 72 | 65 74 75 72 6e 3b 0d 20 |. r|eturn;. |
|000025f0| 20 20 6c 61 73 74 50 74 | 20 3d 20 6c 6f 63 61 6c | lastPt| = local|
|00002600| 50 74 3b 20 20 20 20 2f | 2f 20 73 74 61 72 74 69 |Pt; /|/ starti|
|00002610| 6e 67 20 70 6f 69 6e 74 | 20 6f 66 20 63 75 72 76 |ng point| of curv|
|00002620| 65 0d 20 20 20 64 69 64 | 53 6f 6d 65 44 72 61 77 |e. did|SomeDraw|
|00002630| 69 6e 67 20 3d 20 30 3b | 0d 20 20 20 77 68 69 6c |ing = 0;|. whil|
|00002640| 65 20 28 53 74 69 6c 6c | 44 6f 77 6e 28 29 29 20 |e (Still|Down()) |
|00002650| 7b 20 20 2f 2f 20 63 6f | 6e 74 69 6e 75 65 20 77 |{ // co|ntinue w|
|00002660| 68 69 6c 65 20 74 68 65 | 20 75 73 65 72 20 68 6f |hile the| user ho|
|00002670| 6c 64 73 20 64 6f 77 6e | 20 74 68 65 20 6d 6f 75 |lds down| the mou|
|00002680| 73 65 20 62 75 74 74 6f | 6e 0d 0d 20 20 20 20 20 |se butto|n.. |
|00002690| 20 47 65 74 4d 6f 75 73 | 65 28 26 6e 65 78 74 50 | GetMous|e(&nextP|
|000026a0| 74 29 3b 20 20 2f 2f 20 | 72 65 61 64 20 6d 6f 75 |t); // |read mou|
|000026b0| 73 65 20 6c 6f 63 61 74 | 69 6f 6e 0d 0d 20 20 20 |se locat|ion.. |
|000026c0| 20 20 20 69 66 20 28 6e | 65 78 74 50 74 2e 68 20 | if (n|extPt.h |
|000026d0| 3c 20 30 29 20 20 20 2f | 2f 20 63 6c 69 70 20 6d |< 0) /|/ clip m|
|000026e0| 6f 75 73 65 20 6c 6f 63 | 61 74 69 6f 6e 20 74 6f |ouse loc|ation to|
|000026f0| 20 6d 61 6b 65 20 73 75 | 72 65 20 69 74 20 69 73 | make su|re it is|
|00002700| 20 69 6e 20 77 69 6e 64 | 6f 77 0d 20 20 20 20 20 | in wind|ow. |
|00002710| 20 20 20 20 6e 65 78 74 | 50 74 2e 68 20 3d 20 30 | next|Pt.h = 0|
|00002720| 3b 0d 20 20 20 20 20 20 | 65 6c 73 65 20 69 66 20 |;. |else if |
|00002730| 28 6e 65 78 74 50 74 2e | 68 20 3e 20 77 69 6e 57 |(nextPt.|h > winW|
|00002740| 69 64 74 68 29 0d 20 20 | 20 20 20 20 20 20 20 6e |idth). | n|
|00002750| 65 78 74 50 74 2e 68 20 | 3d 20 77 69 6e 57 69 64 |extPt.h |= winWid|
|00002760| 74 68 3b 0d 20 20 20 20 | 20 20 69 66 20 28 6e 65 |th;. | if (ne|
|00002770| 78 74 50 74 2e 76 20 3c | 20 30 29 0d 20 20 20 20 |xtPt.v <| 0). |
|00002780| 20 20 20 20 20 6e 65 78 | 74 50 74 2e 76 20 3d 20 | nex|tPt.v = |
|00002790| 30 3b 0d 20 20 20 20 20 | 20 65 6c 73 65 20 69 66 |0;. | else if|
|000027a0| 20 28 6e 65 78 74 50 74 | 2e 76 20 3e 20 77 69 6e | (nextPt|.v > win|
|000027b0| 48 65 69 67 68 74 29 0d | 20 20 20 20 20 20 20 20 |Height).| |
|000027c0| 20 6e 65 78 74 50 74 2e | 76 20 3d 20 77 69 6e 48 | nextPt.|v = winH|
|000027d0| 65 69 67 68 74 3b 0d 0d | 20 20 20 20 20 20 69 66 |eight;..| if|
|000027e0| 20 28 20 28 6e 65 78 74 | 50 74 2e 68 2d 6c 61 73 | ( (next|Pt.h-las|
|000027f0| 74 50 74 2e 68 20 3e 20 | 31 29 20 20 20 20 20 20 |tPt.h > |1) |
|00002800| 20 20 20 20 20 20 20 20 | 20 2f 2f 20 74 65 73 74 | | // test|
|00002810| 20 69 66 20 74 68 65 20 | 6e 65 77 20 70 6f 69 6e | if the |new poin|
|00002820| 74 20 69 73 0d 20 20 20 | 20 20 20 20 20 20 20 20 |t is. | |
|00002830| 20 20 7c 7c 20 28 6e 65 | 78 74 50 74 2e 68 2d 6c | || (ne|xtPt.h-l|
|00002840| 61 73 74 50 74 2e 68 20 | 3c 20 2d 31 29 20 20 20 |astPt.h |< -1) |
|00002850| 20 20 20 20 20 20 2f 2f | 20 6e 6f 74 20 74 6f 6f | //| not too|
|00002860| 20 63 6c 6f 73 65 20 74 | 6f 20 6c 61 73 74 20 70 | close t|o last p|
|00002870| 6f 69 6e 74 3b 0d 20 20 | 20 20 20 20 20 20 20 20 |oint;. | |
|00002880| 20 20 20 7c 7c 20 28 6e | 65 78 74 50 74 2e 76 2d | || (n|extPt.v-|
|00002890| 6c 61 73 74 50 74 2e 76 | 20 3e 20 31 29 20 20 20 |lastPt.v| > 1) |
|000028a0| 20 20 20 20 20 20 20 2f | 2f 20 74 68 69 73 20 61 | /|/ this a|
|000028b0| 76 6f 69 64 73 20 73 74 | 6f 72 69 6e 67 0d 20 20 |voids st|oring. |
|000028c0| 20 20 20 20 20 20 20 20 | 20 20 20 7c 7c 20 28 6e | | || (n|
|000028d0| 65 78 74 50 74 2e 76 2d | 6c 61 73 74 50 74 2e 76 |extPt.v-|lastPt.v|
|000028e0| 20 3c 20 2d 31 29 20 29 | 20 7b 20 20 20 20 20 2f | < -1) )| { /|
|000028f0| 2f 20 74 6f 6f 20 6d 61 | 6e 79 20 70 6f 69 6e 74 |/ too ma|ny point|
|00002900| 73 0d 20 20 20 20 20 20 | 20 20 20 69 66 20 28 70 |s. | if (p|
|00002910| 74 43 6f 75 6e 74 20 3d | 3d 20 6d 61 78 50 6f 69 |tCount =|= maxPoi|
|00002920| 6e 74 73 29 20 7b 0d 20 | 20 20 20 20 20 20 20 20 |nts) {. | |
|00002930| 20 20 20 54 65 6c 6c 55 | 73 65 72 28 22 5c 70 45 | TellU|ser("\pE|
|00002940| 61 63 68 20 77 69 6e 64 | 6f 77 20 63 61 6e 20 6f |ach wind|ow can o|
|00002950| 6e 6c 79 20 68 61 76 65 | 20 61 20 63 65 72 74 61 |nly have| a certa|
|00002960| 69 6e 20 61 6d 6f 75 6e | 74 20 6f 66 20 64 61 74 |in amoun|t of dat|
|00002970| 61 2e 20 20 54 68 69 73 | 20 77 69 6e 64 6f 77 27 |a. This| window'|
|00002980| 73 20 64 61 74 61 20 73 | 70 61 63 65 20 69 73 20 |s data s|pace is |
|00002990| 6e 6f 77 20 63 6f 6d 70 | 6c 65 74 65 6c 79 20 66 |now comp|letely f|
|000029a0| 69 6c 6c 65 64 2e 20 20 | 59 6f 75 20 63 61 6e 27 |illed. |You can'|
|000029b0| 74 20 64 6f 20 61 6e 79 | 20 6d 6f 72 65 20 64 72 |t do any| more dr|
|000029c0| 61 77 69 6e 67 20 69 6e | 20 69 74 2e 22 29 3b 0d |awing in| it.");.|
|000029d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 61 6c 6c 46 | | allF|
|000029e0| 69 6c 6c 65 64 55 70 20 | 3d 20 31 3b 20 20 2f 2f |illedUp |= 1; //|
|000029f0| 20 6f 75 74 20 6f 66 20 | 72 6f 6f 6d 3b 20 73 74 | out of |room; st|
|00002a00| 6f 70 20 64 72 61 77 69 | 6e 67 0d 20 20 20 20 20 |op drawi|ng. |
|00002a10| 20 20 20 20 20 20 20 72 | 65 74 75 72 6e 3b 0d 20 | r|eturn;. |
|00002a20| 20 20 20 20 20 20 20 20 | 7d 3b 0d 20 20 20 20 20 | |};. |
|00002a30| 20 20 20 20 70 74 5b 70 | 74 43 6f 75 6e 74 2b 2b | pt[p|tCount++|
|00002a40| 5d 20 3d 20 6c 61 73 74 | 50 74 3b 20 20 20 20 20 |] = last|Pt; |
|00002a50| 20 20 20 2f 2f 20 72 65 | 63 6f 72 64 20 61 20 70 | // re|cord a p|
|00002a60| 6f 69 6e 74 20 69 6e 20 | 64 61 74 61 20 61 72 72 |oint in |data arr|
|00002a70| 61 79 0d 20 20 20 20 20 | 20 20 20 20 50 75 74 4c |ay. | PutL|
|00002a80| 69 6e 65 53 65 67 6d 65 | 6e 74 28 6c 61 73 74 50 |ineSegme|nt(lastP|
|00002a90| 74 2c 6e 65 78 74 50 74 | 29 3b 20 2f 2f 20 61 6e |t,nextPt|); // an|
|00002aa0| 64 20 64 72 61 77 20 74 | 68 65 20 6c 69 6e 65 20 |d draw t|he line |
|00002ab0| 61 6e 64 20 72 65 66 6c | 65 63 74 69 6f 6e 73 0d |and refl|ections.|
|00002ac0| 20 20 20 20 20 20 20 20 | 20 6c 61 73 74 50 74 20 | | lastPt |
|00002ad0| 3d 20 6e 65 78 74 50 74 | 3b 0d 20 20 20 20 20 20 |= nextPt|;. |
|00002ae0| 20 20 20 64 69 64 53 6f | 6d 65 44 72 61 77 69 6e | didSo|meDrawin|
|00002af0| 67 20 3d 20 31 3b 20 20 | 2f 2f 20 72 65 6d 65 6d |g = 1; |// remem|
|00002b00| 62 65 72 20 74 68 61 74 | 20 61 74 20 6c 65 61 73 |ber that| at leas|
|00002b10| 74 20 6f 6e 65 20 70 6f | 69 6e 74 20 77 61 73 20 |t one po|int was |
|00002b20| 72 65 63 6f 72 64 65 64 | 0d 20 20 20 20 20 20 7d |recorded|. }|
|00002b30| 3b 0d 20 20 20 7d 3b 0d | 20 20 20 0d 20 20 20 69 |;. };.| . i|
|00002b40| 66 20 28 64 69 64 53 6f | 6d 65 44 72 61 77 69 6e |f (didSo|meDrawin|
|00002b50| 67 20 26 26 20 70 74 43 | 6f 75 6e 74 20 3c 20 6d |g && ptC|ount < m|
|00002b60| 61 78 50 6f 69 6e 74 73 | 29 0d 20 20 20 20 20 20 |axPoints|). |
|00002b70| 70 74 5b 70 74 43 6f 75 | 6e 74 2b 2b 5d 2e 68 20 |pt[ptCou|nt++].h |
|00002b80| 3d 20 2d 31 3b 20 20 2f | 2f 20 69 66 20 61 6e 79 |= -1; /|/ if any|
|00002b90| 20 70 6f 69 6e 74 73 20 | 77 65 72 65 20 73 74 6f | points |were sto|
|00002ba0| 72 65 64 2c 20 70 75 74 | 20 61 20 73 65 6e 74 69 |red, put| a senti|
|00002bb0| 6e 65 6c 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |nel. | |
|00002bc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002bd0| 20 2f 2f 20 69 6e 20 74 | 68 65 20 61 72 72 61 79 | // in t|he array|
|00002be0| 20 74 6f 20 73 65 70 61 | 72 61 74 65 20 74 68 69 | to sepa|rate thi|
|00002bf0| 73 20 63 75 72 76 65 20 | 66 72 6f 6d 20 74 68 65 |s curve |from the|
|00002c00| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00002c10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2f | | //|
|00002c20| 20 6e 65 78 74 20 6f 6e | 65 20 74 68 65 20 75 73 | next on|e the us|
|00002c30| 65 72 20 6d 69 67 68 74 | 20 64 72 61 77 20 20 28 |er might| draw (|
|00002c40| 73 6f 20 74 68 61 74 20 | 74 68 65 79 0d 20 20 20 |so that |they. |
|00002c50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002c60| 20 20 20 20 20 20 20 20 | 20 20 2f 2f 20 61 72 65 | | // are|
|00002c70| 20 6e 6f 74 20 63 6f 6e | 6e 65 63 74 65 64 20 77 | not con|nected w|
|00002c80| 68 65 6e 20 74 68 65 20 | 77 69 6e 64 6f 77 20 69 |hen the |window i|
|00002c90| 73 20 72 65 64 72 61 77 | 6e 29 0d 7d 0d 0d 0d 76 |s redraw|n).}...v|
|00002ca0| 6f 69 64 20 6d 79 57 69 | 6e 64 6f 77 3a 3a 64 6f |oid myWi|ndow::do|
|00002cb0| 52 65 64 72 61 77 28 52 | 65 63 74 2a 20 62 61 64 |Redraw(R|ect* bad|
|00002cc0| 52 65 63 74 29 7b 0d 20 | 20 20 73 68 6f 72 74 20 |Rect){. | short |
|00002cd0| 69 3b 0d 20 20 20 69 66 | 20 28 70 74 43 6f 75 6e |i;. if| (ptCoun|
|00002ce0| 74 20 3e 20 30 29 20 20 | 20 20 20 20 2f 2f 20 72 |t > 0) | // r|
|00002cf0| 65 64 72 61 77 20 61 6e | 79 20 63 75 72 76 65 73 |edraw an|y curves|
|00002d00| 20 65 6e 74 65 72 65 64 | 20 70 72 65 76 69 6f 75 | entered| previou|
|00002d10| 73 6c 79 20 62 79 20 75 | 73 65 72 0d 20 20 20 20 |sly by u|ser. |
|00002d20| 20 66 6f 72 20 28 69 3d | 31 3b 20 69 3c 70 74 43 | for (i=|1; i<ptC|
|00002d30| 6f 75 6e 74 3b 20 69 2b | 2b 29 0d 20 20 20 20 20 |ount; i+|+). |
|00002d40| 20 20 20 69 66 20 28 70 | 74 5b 69 5d 2e 68 20 21 | if (p|t[i].h !|
|00002d50| 3d 20 2d 31 20 26 26 20 | 70 74 5b 69 2d 31 5d 2e |= -1 && |pt[i-1].|
|00002d60| 68 20 21 3d 20 2d 31 29 | 20 20 2f 2f 20 61 6e 20 |h != -1)| // an |
|00002d70| 68 20 76 61 6c 75 65 20 | 6f 66 20 2d 31 20 69 73 |h value |of -1 is|
|00002d80| 20 6e 6f 74 0d 20 20 20 | 20 20 20 20 20 20 20 20 | not. | |
|00002d90| 50 75 74 4c 69 6e 65 53 | 65 67 6d 65 6e 74 28 70 |PutLineS|egment(p|
|00002da0| 74 5b 69 2d 31 5d 2c 70 | 74 5b 69 5d 29 3b 20 20 |t[i-1],p|t[i]); |
|00002db0| 20 20 20 20 2f 2f 20 61 | 63 74 75 61 6c 6c 79 20 | // a|ctually |
|00002dc0| 6f 6e 20 61 20 63 75 72 | 76 65 3b 20 74 68 69 73 |on a cur|ve; this|
|00002dd0| 20 69 73 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 | is. | |
|00002de0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002df0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002e00| 20 20 20 2f 2f 20 61 20 | 73 65 6e 74 69 6e 65 6c | // a |sentinel|
|00002e10| 20 76 61 6c 75 65 20 62 | 65 74 77 65 65 6e 20 63 | value b|etween c|
|00002e20| 75 72 76 65 73 0d 7d 0d | 0d 0d 76 6f 69 64 20 6d |urves.}.|..void m|
|00002e30| 79 57 69 6e 64 6f 77 3a | 3a 61 64 6a 75 73 74 54 |yWindow:|:adjustT|
|00002e40| 6f 4e 65 77 53 69 7a 65 | 28 76 6f 69 64 29 20 7b |oNewSize|(void) {|
|00002e50| 0d 20 20 20 52 65 63 74 | 20 6f 6c 64 52 65 63 74 |. Rect| oldRect|
|00002e60| 2c 6e 65 77 52 65 63 74 | 3b 0d 20 20 20 73 68 6f |,newRect|;. sho|
|00002e70| 72 74 20 69 3b 0d 20 20 | 20 69 6e 68 65 72 69 74 |rt i;. | inherit|
|00002e80| 65 64 3a 3a 61 64 6a 75 | 73 74 54 6f 4e 65 77 53 |ed::adju|stToNewS|
|00002e90| 69 7a 65 28 29 3b 0d 20 | 20 20 0d 20 20 20 20 2f |ize();. | . /|
|00002ea0| 2f 20 52 65 73 63 61 6c | 65 20 74 68 65 20 70 6f |/ Rescal|e the po|
|00002eb0| 69 6e 74 73 20 74 6f 20 | 66 69 74 20 63 6f 72 72 |ints to |fit corr|
|00002ec0| 65 63 74 6c 79 20 69 6e | 74 6f 20 74 68 65 20 6e |ectly in|to the n|
|00002ed0| 65 77 6c 79 20 72 65 73 | 69 7a 65 64 20 77 69 6e |ewly res|ized win|
|00002ee0| 64 6f 77 3b 0d 20 20 20 | 20 2f 2f 20 62 65 20 63 |dow;. | // be c|
|00002ef0| 61 72 65 66 75 6c 20 6e | 6f 74 20 74 6f 20 73 63 |areful n|ot to sc|
|00002f00| 61 6c 65 20 74 68 65 20 | 73 65 6e 74 69 6e 65 6c |ale the |sentinel|
|00002f10| 20 70 6f 69 6e 74 73 20 | 77 69 74 68 20 68 20 3d | points |with h =|
|00002f20| 20 2d 31 20 61 73 20 74 | 68 65 73 65 0d 20 20 20 | -1 as t|hese. |
|00002f30| 20 2f 2f 20 61 72 65 20 | 6e 6f 74 20 72 65 61 6c | // are |not real|
|00002f40| 6c 79 20 70 6f 69 6e 74 | 73 2c 20 62 75 74 20 61 |ly point|s, but a|
|00002f50| 72 65 20 6f 6e 6c 79 20 | 74 68 65 72 65 20 74 6f |re only |there to|
|00002f60| 20 73 65 70 61 72 61 74 | 65 20 64 61 74 61 20 66 | separat|e data f|
|00002f70| 6f 72 0d 20 20 20 20 2f | 2f 20 64 69 66 66 65 72 |or. /|/ differ|
|00002f80| 65 6e 74 20 63 75 72 76 | 65 73 2e 20 20 28 4e 4f |ent curv|es. (NO|
|00002f90| 54 45 3a 20 20 62 65 63 | 61 75 73 65 20 63 6f 6f |TE: bec|ause coo|
|00002fa0| 72 64 69 6e 61 74 65 73 | 20 61 72 65 20 69 6e 74 |rdinates| are int|
|00002fb0| 65 67 65 72 73 2c 0d 20 | 20 20 20 2f 2f 20 74 68 |egers,. | // th|
|00002fc0| 65 20 73 63 61 6c 69 6e | 67 20 64 6f 6e 65 20 68 |e scalin|g done h|
|00002fd0| 65 72 65 20 69 6e 76 6f | 6c 76 65 73 20 73 6f 6d |ere invo|lves som|
|00002fe0| 65 20 72 6f 75 6e 64 69 | 6e 67 20 65 72 72 6f 72 |e roundi|ng error|
|00002ff0| 73 2c 20 77 68 69 63 68 | 0d 20 20 20 20 2f 2f 20 |s, which|. // |
|00003000| 69 6e 74 72 6f 64 75 63 | 65 73 20 73 6f 6d 65 20 |introduc|es some |
|00003010| 64 69 73 74 6f 72 74 69 | 6f 6e 73 20 69 6e 74 6f |distorti|ons into|
|00003020| 20 74 68 65 20 69 6d 61 | 67 65 2e 29 0d 20 20 20 | the ima|ge.). |
|00003030| 20 0d 20 20 20 53 65 74 | 52 65 63 74 28 26 6f 6c | . Set|Rect(&ol|
|00003040| 64 52 65 63 74 2c 30 2c | 30 2c 77 69 6e 57 69 64 |dRect,0,|0,winWid|
|00003050| 74 68 2c 77 69 6e 48 65 | 69 67 68 74 29 3b 0d 20 |th,winHe|ight);. |
|00003060| 20 20 53 65 74 52 65 63 | 74 28 26 6e 65 77 52 65 | SetRec|t(&newRe|
|00003070| 63 74 2c 30 2c 30 2c 74 | 68 65 57 69 6e 64 6f 77 |ct,0,0,t|heWindow|
|00003080| 2d 3e 70 6f 72 74 52 65 | 63 74 2e 72 69 67 68 74 |->portRe|ct.right|
|00003090| 20 2d 20 31 2c 74 68 65 | 57 69 6e 64 6f 77 2d 3e | - 1,the|Window->|
|000030a0| 70 6f 72 74 52 65 63 74 | 2e 62 6f 74 74 6f 6d 20 |portRect|.bottom |
|000030b0| 2d 20 31 29 3b 0d 20 20 | 20 20 2f 2f 20 54 68 65 |- 1);. | // The|
|000030c0| 73 65 20 72 65 63 74 61 | 6e 67 6c 65 73 20 61 72 |se recta|ngles ar|
|000030d0| 65 20 72 65 71 75 69 72 | 65 64 20 66 6f 72 20 74 |e requir|ed for t|
|000030e0| 68 65 20 4d 61 63 20 74 | 6f 6f 6c 62 6f 78 20 66 |he Mac t|oolbox f|
|000030f0| 75 6e 63 74 69 6f 6e 20 | 53 63 61 6c 65 50 74 0d |unction |ScalePt.|
|00003100| 20 20 20 20 2f 2f 20 77 | 68 69 63 68 20 69 73 20 | // w|hich is |
|00003110| 75 73 65 64 20 74 6f 20 | 64 6f 20 74 68 65 20 73 |used to |do the s|
|00003120| 63 61 6c 69 6e 67 2e 20 | 20 6f 6c 64 52 65 63 74 |caling. | oldRect|
|00003130| 20 69 73 20 74 68 65 20 | 6f 6c 64 20 77 69 6e 64 | is the |old wind|
|00003140| 6f 77 20 72 65 63 74 61 | 6e 67 6c 65 2c 0d 20 20 |ow recta|ngle,. |
|00003150| 20 20 2f 2f 20 61 6e 64 | 20 6e 65 77 52 65 63 74 | // and| newRect|
|00003160| 20 69 73 20 74 68 65 20 | 77 69 6e 64 6f 77 20 72 | is the |window r|
|00003170| 65 63 74 61 6e 67 6c 65 | 20 61 66 74 65 72 20 72 |ectangle| after r|
|00003180| 65 73 69 7a 69 6e 67 2e | 20 20 28 54 68 65 20 73 |esizing.| (The s|
|00003190| 69 7a 65 20 6f 66 20 74 | 68 65 0d 20 20 20 20 2f |ize of t|he. /|
|000031a0| 2f 20 6f 6c 64 20 72 65 | 63 74 61 6e 67 6c 65 20 |/ old re|ctangle |
|000031b0| 68 61 73 20 74 6f 20 62 | 65 20 72 65 6d 65 6d 62 |has to b|e rememb|
|000031c0| 65 72 65 64 20 69 6e 20 | 74 68 65 20 77 69 6e 64 |ered in |the wind|
|000031d0| 6f 77 20 64 61 74 61 20 | 76 61 72 69 61 62 6c 65 |ow data |variable|
|000031e0| 73 0d 20 20 20 20 2f 2f | 20 77 69 6e 48 65 69 67 |s. //| winHeig|
|000031f0| 68 74 20 61 6e 64 20 77 | 69 6e 57 69 64 74 68 2e |ht and w|inWidth.|
|00003200| 29 0d 20 20 20 0d 20 20 | 20 66 6f 72 20 28 69 3d |). . | for (i=|
|00003210| 30 3b 20 69 3c 70 74 43 | 6f 75 6e 74 3b 20 69 2b |0; i<ptC|ount; i+|
|00003220| 2b 29 20 7b 20 20 2f 2f | 20 73 63 61 6c 65 20 74 |+) { //| scale t|
|00003230| 68 65 20 70 6f 69 6e 74 | 73 0d 20 20 20 20 20 20 |he point|s. |
|00003240| 69 66 20 28 70 74 5b 69 | 5d 2e 68 20 21 3d 20 2d |if (pt[i|].h != -|
|00003250| 31 29 0d 20 20 20 20 20 | 20 20 20 20 20 53 63 61 |1). | Sca|
|00003260| 6c 65 50 74 28 70 74 2b | 69 2c 20 26 6f 6c 64 52 |lePt(pt+|i, &oldR|
|00003270| 65 63 74 2c 20 26 6e 65 | 77 52 65 63 74 29 3b 0d |ect, &ne|wRect);.|
|00003280| 20 20 20 7d 3b 0d 20 20 | 20 0d 20 20 20 77 69 6e | };. | . win|
|00003290| 57 69 64 74 68 20 3d 20 | 6e 65 77 52 65 63 74 2e |Width = |newRect.|
|000032a0| 72 69 67 68 74 3b 20 20 | 20 2f 2f 20 72 65 63 6f |right; | // reco|
|000032b0| 72 64 20 63 75 72 72 65 | 6e 74 20 77 69 6e 64 6f |rd curre|nt windo|
|000032c0| 77 20 73 69 7a 65 0d 20 | 20 20 77 69 6e 48 65 69 |w size. | winHei|
|000032d0| 67 68 74 20 3d 20 6e 65 | 77 52 65 63 74 2e 62 6f |ght = ne|wRect.bo|
|000032e0| 74 74 6f 6d 3b 0d 20 20 | 20 0d 7d 0d 0d 0d 76 6f |ttom;. | .}...vo|
|000032f0| 69 64 20 6d 79 57 69 6e | 64 6f 77 3a 3a 64 6f 48 |id myWin|dow::doH|
|00003300| 53 63 72 6f 6c 6c 28 69 | 6e 74 20 64 68 29 20 7b |Scroll(i|nt dh) {|
|00003310| 0d 20 20 20 69 6e 68 65 | 72 69 74 65 64 3a 3a 64 |. inhe|rited::d|
|00003320| 6f 48 53 63 72 6f 6c 6c | 28 64 68 29 3b 0d 7d 0d |oHScroll|(dh);.}.|
|00003330| 0d 76 6f 69 64 20 6d 79 | 57 69 6e 64 6f 77 3a 3a |.void my|Window::|
|00003340| 64 6f 56 53 63 72 6f 6c | 6c 28 69 6e 74 20 64 76 |doVScrol|l(int dv|
|00003350| 29 20 7b 0d 20 20 20 69 | 6e 68 65 72 69 74 65 64 |) {. i|nherited|
|00003360| 3a 3a 64 6f 56 53 63 72 | 6f 6c 6c 28 64 76 29 3b |::doVScr|oll(dv);|
|00003370| 0d 7d 0d 0d 76 6f 69 64 | 20 6d 79 57 69 6e 64 6f |.}..void| myWindo|
|00003380| 77 3a 3a 64 6f 41 63 74 | 69 76 61 74 65 28 69 6e |w::doAct|ivate(in|
|00003390| 74 20 61 63 74 69 76 65 | 29 20 7b 0d 20 20 20 69 |t active|) {. i|
|000033a0| 6e 68 65 72 69 74 65 64 | 3a 3a 64 6f 41 63 74 69 |nherited|::doActi|
|000033b0| 76 61 74 65 28 61 63 74 | 69 76 65 29 3b 0d 7d 0d |vate(act|ive);.}.|
|000033c0| 0d 76 6f 69 64 20 49 6e | 69 74 41 70 70 6c 69 63 |.void In|itApplic|
|000033d0| 61 74 69 6f 6e 28 76 6f | 69 64 29 20 7b 0d 20 20 |ation(vo|id) {. |
|000033e0| 4d 65 6e 75 48 61 6e 64 | 6c 65 20 61 70 70 6c 65 |MenuHand|le apple|
|000033f0| 4d 65 6e 75 3b 0d 20 20 | 66 69 6c 65 4d 65 6e 75 |Menu;. |fileMenu|
|00003400| 20 3d 20 47 65 74 4d 48 | 61 6e 64 6c 65 28 32 29 | = GetMH|andle(2)|
|00003410| 3b 0d 20 20 65 64 69 74 | 4d 65 6e 75 20 3d 20 47 |;. edit|Menu = G|
|00003420| 65 74 4d 48 61 6e 64 6c | 65 28 33 29 3b 0d 20 20 |etMHandl|e(3);. |
|00003430| 61 70 70 6c 65 4d 65 6e | 75 20 3d 20 47 65 74 4d |appleMen|u = GetM|
|00003440| 48 61 6e 64 6c 65 28 31 | 29 3b 0d 20 20 53 65 74 |Handle(1|);. Set|
|00003450| 49 74 65 6d 28 61 70 70 | 6c 65 4d 65 6e 75 2c 31 |Item(app|leMenu,1|
|00003460| 2c 22 5c 70 41 62 6f 75 | 74 20 4b 61 6c 65 69 64 |,"\pAbou|t Kaleid|
|00003470| 6f 53 6b 65 74 63 68 2e | 2e 2e 22 29 3b 20 2f 2f |oSketch.|.."); //|
|00003480| 20 50 72 6f 67 72 61 6d | 20 6e 61 6d 65 20 66 6f | Program| name fo|
|00003490| 72 20 41 70 70 6c 65 20 | 4d 65 6e 75 0d 20 20 53 |r Apple |Menu. S|
|000034a0| 65 74 49 74 65 6d 28 66 | 69 6c 65 4d 65 6e 75 2c |etItem(f|ileMenu,|
|000034b0| 31 2c 22 5c 70 4e 65 77 | 22 29 3b 20 20 2f 2f 20 |1,"\pNew|"); // |
|000034c0| 52 65 70 6c 61 63 65 73 | 20 22 4e 65 77 20 57 69 |Replaces| "New Wi|
|000034d0| 6e 64 6f 77 22 20 69 6e | 20 66 69 6c 65 20 6d 65 |ndow" in| file me|
|000034e0| 6e 75 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |nu. | |
|000034f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003500| 20 20 20 2f 2f 20 20 28 | 53 65 65 6d 73 20 62 65 | // (|Seems be|
|00003510| 74 74 65 72 20 66 6f 72 | 20 61 20 70 72 6f 67 72 |tter for| a progr|
|00003520| 61 6d 20 74 68 61 74 20 | 75 73 65 73 20 66 69 6c |am that |uses fil|
|00003530| 65 73 2e 29 0d 20 20 49 | 6e 73 4d 65 6e 75 49 74 |es.). I|nsMenuIt|
|00003540| 65 6d 28 66 69 6c 65 4d | 65 6e 75 2c 20 22 5c 70 |em(fileM|enu, "\p|
|00003550| 53 61 76 65 2f 53 3b 4f | 70 65 6e 2f 4f 22 2c 20 |Save/S;O|pen/O", |
|00003560| 31 29 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |1);. | |
|00003570| 20 20 20 20 20 20 2f 2f | 20 41 64 64 20 74 77 6f | //| Add two|
|00003580| 20 66 69 6c 65 2d 6f 72 | 69 65 6e 74 65 64 20 63 | file-or|iented c|
|00003590| 6f 6d 6d 61 6e 64 73 20 | 61 73 20 65 6e 74 72 69 |ommands |as entri|
|000035a0| 65 73 20 23 32 20 61 6e | 64 20 33 20 69 6e 20 66 |es #2 an|d 3 in f|
|000035b0| 69 6c 65 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ile. | |
|000035c0| 20 20 20 20 20 20 2f 2f | 20 6d 65 6e 75 3b 20 28 | //| menu; (|
|000035d0| 4e 6f 74 65 20 74 68 61 | 74 20 79 6f 75 20 63 6f |Note tha|t you co|
|000035e0| 75 6c 64 20 75 73 65 20 | 52 65 73 45 64 69 74 20 |uld use |ResEdit |
|000035f0| 74 6f 20 62 75 69 6c 64 | 20 6d 65 6e 75 73 2e 29 |to build| menus.)|
|00003600| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00003610| 20 20 20 2f 2f 20 4e 6f | 74 65 20 74 68 61 74 20 | // No|te that |
|00003620| 74 68 65 20 69 74 65 6d | 20 6e 75 6d 62 65 72 73 |the item| numbers|
|00003630| 20 66 6f 72 20 51 75 69 | 74 20 61 6e 64 20 43 6c | for Qui|t and Cl|
|00003640| 6f 73 65 20 63 6f 6d 6d | 61 6e 64 0d 20 20 20 20 |ose comm|and. |
|00003650| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2f | | //|
|00003660| 20 61 72 65 20 63 68 61 | 6e 67 65 64 2c 20 77 68 | are cha|nged, wh|
|00003670| 69 63 68 20 66 6f 72 63 | 65 73 20 73 6f 6d 65 20 |ich forc|es some |
|00003680| 63 68 61 6e 67 65 73 20 | 69 6e 20 66 75 6e 63 74 |changes |in funct|
|00003690| 69 6f 6e 73 0d 20 20 20 | 20 20 20 20 20 20 20 20 |ions. | |
|000036a0| 20 20 20 20 20 20 20 2f | 2f 20 55 70 64 61 74 65 | /|/ Update|
|000036b0| 4d 65 6e 75 73 20 61 6e | 64 20 44 6f 46 69 6c 65 |Menus an|d DoFile|
|000036c0| 4d 65 6e 75 2e 0d 20 20 | 44 6f 4e 65 77 43 6f 6d |Menu.. |DoNewCom|
|000036d0| 6d 61 6e 64 28 29 3b 0d | 7d 0d 0d 76 6f 69 64 20 |mand();.|}..void |
|000036e0| 55 70 64 61 74 65 4d 65 | 6e 75 73 28 76 6f 69 64 |UpdateMe|nus(void|
|000036f0| 29 20 7b 0d 20 20 20 73 | 68 6f 72 74 20 69 3b 0d |) {. s|hort i;.|
|00003700| 20 20 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e | Windo|wPtr win|
|00003710| 3b 0d 20 20 20 78 57 69 | 6e 64 6f 77 20 2a 78 77 |;. xWi|ndow *xw|
|00003720| 69 6e 3b 0d 20 20 20 77 | 69 6e 20 3d 20 46 72 6f |in;. w|in = Fro|
|00003730| 6e 74 57 69 6e 64 6f 77 | 28 29 3b 0d 20 20 20 69 |ntWindow|();. i|
|00003740| 66 20 28 20 77 69 6e 20 | 26 26 20 28 28 57 69 6e |f ( win |&& ((Win|
|00003750| 64 6f 77 50 65 65 6b 29 | 77 69 6e 29 2d 3e 77 69 |dowPeek)|win)->wi|
|00003760| 6e 64 6f 77 4b 69 6e 64 | 20 3c 20 30 20 29 20 7b |ndowKind| < 0 ) {|
|00003770| 0d 20 20 20 20 20 20 45 | 6e 61 62 6c 65 49 74 65 |. E|nableIte|
|00003780| 6d 28 65 64 69 74 4d 65 | 6e 75 2c 31 29 3b 0d 20 |m(editMe|nu,1);. |
|00003790| 20 20 20 20 20 66 6f 72 | 20 28 69 3d 33 3b 20 69 | for| (i=3; i|
|000037a0| 3c 37 3b 20 69 2b 2b 29 | 0d 20 20 20 20 20 20 20 |<7; i++)|. |
|000037b0| 20 20 45 6e 61 62 6c 65 | 49 74 65 6d 28 65 64 69 | Enable|Item(edi|
|000037c0| 74 4d 65 6e 75 2c 69 29 | 3b 0d 20 20 20 7d 0d 20 |tMenu,i)|;. }. |
|000037d0| 20 20 65 6c 73 65 20 7b | 0d 20 20 20 20 20 20 44 | else {|. D|
|000037e0| 69 73 61 62 6c 65 49 74 | 65 6d 28 65 64 69 74 4d |isableIt|em(editM|
|000037f0| 65 6e 75 2c 31 29 3b 0d | 20 20 20 20 20 20 66 6f |enu,1);.| fo|
|00003800| 72 20 28 69 3d 33 3b 20 | 69 3c 36 3b 20 69 2b 2b |r (i=3; |i<6; i++|
|00003810| 29 20 20 20 20 20 20 20 | 20 20 2f 2f 20 23 36 20 |) | // #6 |
|00003820| 28 22 43 6c 65 61 72 22 | 29 20 69 73 20 68 61 6e |("Clear"|) is han|
|00003830| 64 6c 65 64 20 62 65 6c | 6f 77 0d 20 20 20 20 20 |dled bel|ow. |
|00003840| 20 20 20 20 44 69 73 61 | 62 6c 65 49 74 65 6d 28 | Disa|bleItem(|
|00003850| 65 64 69 74 4d 65 6e 75 | 2c 69 29 3b 0d 20 20 20 |editMenu|,i);. |
|00003860| 7d 0d 20 20 20 69 66 20 | 28 77 69 6e 20 26 26 20 |}. if |(win && |
|00003870| 78 57 69 6e 64 6f 77 3a | 3a 57 69 6e 64 6f 77 32 |xWindow:|:Window2|
|00003880| 58 57 69 6e 64 6f 77 28 | 77 69 6e 2c 26 78 77 69 |XWindow(|win,&xwi|
|00003890| 6e 29 29 20 7b 0d 20 20 | 20 20 20 20 20 20 2f 2f |n)) {. | //|
|000038a0| 20 74 68 65 20 66 72 6f | 6e 74 6d 6f 73 74 20 77 | the fro|ntmost w|
|000038b0| 69 6e 64 6f 77 20 69 73 | 20 6f 6e 65 20 62 65 6c |indow is| one bel|
|000038c0| 6f 6e 67 69 6e 67 20 74 | 6f 20 74 68 69 73 20 70 |onging t|o this p|
|000038d0| 72 6f 67 72 61 6d 2c 20 | 73 6f 20 49 20 77 61 6e |rogram, |so I wan|
|000038e0| 74 0d 20 20 20 20 20 20 | 20 20 2f 2f 20 74 6f 20 |t. | // to |
|000038f0| 65 6e 61 62 6c 65 20 74 | 68 65 20 63 6f 6d 6d 61 |enable t|he comma|
|00003900| 6e 64 73 20 74 68 61 74 | 20 61 72 65 20 77 69 6e |nds that| are win|
|00003910| 64 6f 77 2d 64 69 72 65 | 63 74 65 64 2c 20 73 75 |dow-dire|cted, su|
|00003920| 63 68 20 61 73 20 43 6c | 6f 73 65 2c 0d 20 20 20 |ch as Cl|ose,. |
|00003930| 20 20 20 20 20 2f 2f 20 | 61 6e 64 20 70 6f 73 73 | // |and poss|
|00003940| 69 62 6c 79 20 43 6c 65 | 61 72 20 61 6e 64 20 53 |ibly Cle|ar and S|
|00003950| 61 76 65 20 28 69 66 20 | 74 68 65 20 77 69 6e 64 |ave (if |the wind|
|00003960| 6f 77 20 69 73 20 6e 6f | 74 20 65 6d 70 74 79 29 |ow is no|t empty)|
|00003970| 2e 0d 20 20 20 20 20 20 | 45 6e 61 62 6c 65 49 74 |.. |EnableIt|
|00003980| 65 6d 28 66 69 6c 65 4d | 65 6e 75 2c 34 29 3b 20 |em(fileM|enu,4); |
|00003990| 20 2f 2f 20 43 6c 6f 73 | 65 20 57 69 6e 64 6f 77 | // Clos|e Window|
|000039a0| 20 43 6f 6d 6d 61 6e 64 | 0d 20 20 20 20 20 20 20 | Command|. |
|000039b0| 20 20 2f 2f 20 54 68 65 | 20 6e 65 78 74 20 6c 69 | // The| next li|
|000039c0| 6e 65 20 63 68 65 63 6b | 73 20 77 68 65 74 68 65 |ne check|s whethe|
|000039d0| 72 20 61 6e 79 74 68 69 | 6e 67 20 68 61 73 20 62 |r anythi|ng has b|
|000039e0| 65 65 6e 20 64 72 61 77 | 6e 20 69 6e 20 74 68 65 |een draw|n in the|
|000039f0| 20 66 72 6f 6e 74 0d 20 | 20 20 20 20 20 20 20 20 | front. | |
|00003a00| 2f 2f 20 77 69 6e 64 6f | 77 2e 20 20 54 68 65 20 |// windo|w. The |
|00003a10| 74 79 70 65 2d 63 61 73 | 74 20 28 6d 79 57 69 6e |type-cas|t (myWin|
|00003a20| 64 6f 77 2a 29 20 69 73 | 20 72 65 71 75 69 72 65 |dow*) is| require|
|00003a30| 64 20 74 6f 20 67 65 74 | 20 61 63 63 65 73 73 20 |d to get| access |
|00003a40| 74 6f 0d 20 20 20 20 20 | 20 20 20 20 2f 2f 20 70 |to. | // p|
|00003a50| 74 43 6f 75 6e 74 2c 20 | 73 69 6e 63 65 20 74 68 |tCount, |since th|
|00003a60| 65 20 63 6f 6d 70 69 6c | 65 72 20 6b 6e 6f 77 73 |e compil|er knows|
|00003a70| 20 6f 6e 6c 79 20 74 68 | 61 74 20 78 77 69 6e 20 | only th|at xwin |
|00003a80| 69 73 20 61 6e 20 78 57 | 69 6e 64 6f 77 2e 0d 20 |is an xW|indow.. |
|00003a90| 20 20 20 20 20 69 66 20 | 28 20 28 28 6d 79 57 69 | if |( ((myWi|
|00003aa0| 6e 64 6f 77 2a 29 78 77 | 69 6e 29 2d 3e 70 74 43 |ndow*)xw|in)->ptC|
|00003ab0| 6f 75 6e 74 20 3e 20 30 | 20 29 20 7b 0d 20 20 20 |ount > 0| ) {. |
|00003ac0| 20 20 20 20 20 20 45 6e | 61 62 6c 65 49 74 65 6d | En|ableItem|
|00003ad0| 28 66 69 6c 65 4d 65 6e | 75 2c 33 29 3b 20 20 2f |(fileMen|u,3); /|
|00003ae0| 2f 20 53 61 76 65 20 43 | 6f 6d 6d 61 6e 64 0d 20 |/ Save C|ommand. |
|00003af0| 20 20 20 20 20 20 20 20 | 45 6e 61 62 6c 65 49 74 | |EnableIt|
|00003b00| 65 6d 28 65 64 69 74 4d | 65 6e 75 2c 36 29 3b 20 |em(editM|enu,6); |
|00003b10| 20 2f 2f 20 43 6c 65 61 | 72 20 43 6f 6d 6d 61 6e | // Clea|r Comman|
|00003b20| 64 0d 20 20 20 20 20 20 | 7d 0d 20 20 20 20 20 20 |d. |}. |
|00003b30| 65 6c 73 65 20 7b 20 20 | 2f 2f 20 66 72 6f 6e 74 |else { |// front|
|00003b40| 20 77 69 6e 64 6f 77 20 | 69 73 20 65 6d 70 74 79 | window |is empty|
|00003b50| 3b 20 6e 6f 74 68 69 6e | 67 20 74 6f 20 73 61 76 |; nothin|g to sav|
|00003b60| 65 20 6f 72 20 63 6c 65 | 61 72 0d 20 20 20 20 20 |e or cle|ar. |
|00003b70| 20 20 20 20 44 69 73 61 | 62 6c 65 49 74 65 6d 28 | Disa|bleItem(|
|00003b80| 66 69 6c 65 4d 65 6e 75 | 2c 33 29 3b 20 0d 20 20 |fileMenu|,3); . |
|00003b90| 20 20 20 20 20 20 20 44 | 69 73 61 62 6c 65 49 74 | D|isableIt|
|00003ba0| 65 6d 28 65 64 69 74 4d | 65 6e 75 2c 36 29 3b 0d |em(editM|enu,6);.|
|00003bb0| 20 20 20 20 20 20 7d 0d | 20 20 20 7d 0d 20 20 20 | }.| }. |
|00003bc0| 65 6c 73 65 20 7b 20 20 | 2f 2f 20 4e 6f 20 66 72 |else { |// No fr|
|00003bd0| 6f 6e 74 20 77 69 6e 64 | 6f 77 20 74 6f 20 63 6c |ont wind|ow to cl|
|00003be0| 6f 73 65 2c 20 73 61 76 | 65 2c 20 6f 72 20 63 6c |ose, sav|e, or cl|
|00003bf0| 65 61 72 0d 20 20 20 20 | 20 20 44 69 73 61 62 6c |ear. | Disabl|
|00003c00| 65 49 74 65 6d 28 66 69 | 6c 65 4d 65 6e 75 2c 33 |eItem(fi|leMenu,3|
|00003c10| 29 3b 0d 20 20 20 20 20 | 20 44 69 73 61 62 6c 65 |);. | Disable|
|00003c20| 49 74 65 6d 28 66 69 6c | 65 4d 65 6e 75 2c 34 29 |Item(fil|eMenu,4)|
|00003c30| 3b 0d 20 20 20 20 20 20 | 44 69 73 61 62 6c 65 49 |;. |DisableI|
|00003c40| 74 65 6d 28 65 64 69 74 | 4d 65 6e 75 2c 36 29 3b |tem(edit|Menu,6);|
|00003c50| 0d 20 20 20 7d 0d 7d 0d | 0d 76 6f 69 64 20 44 6f |. }.}.|.void Do|
|00003c60| 45 64 69 74 4d 65 6e 75 | 28 69 6e 74 20 69 74 65 |EditMenu|(int ite|
|00003c70| 6d 4e 75 6d 29 20 7b 0d | 20 20 20 2f 2f 20 68 61 |mNum) {.| // ha|
|00003c80| 76 69 6e 67 20 64 65 63 | 69 64 65 64 20 74 6f 20 |ving dec|ided to |
|00003c90| 75 73 65 20 74 68 65 20 | 43 6c 65 61 72 20 63 6f |use the |Clear co|
|00003ca0| 6d 6d 61 6e 64 20 66 72 | 6f 6d 20 74 68 65 20 45 |mmand fr|om the E|
|00003cb0| 64 69 74 20 6d 65 6e 75 | 20 69 6e 20 6d 79 0d 20 |dit menu| in my. |
|00003cc0| 20 20 2f 2f 20 70 72 6f | 67 72 61 6d 2c 20 49 20 | // pro|gram, I |
|00003cd0| 68 61 76 65 20 74 6f 20 | 68 61 6e 64 6c 65 20 69 |have to |handle i|
|00003ce0| 74 20 68 65 72 65 2e 20 | 20 4e 6f 74 65 20 61 67 |t here. | Note ag|
|00003cf0| 61 69 6e 20 74 68 65 20 | 75 73 65 20 6f 66 20 74 |ain the |use of t|
|00003d00| 79 70 65 2d 0d 20 20 20 | 2f 2f 20 63 61 73 74 69 |ype-. |// casti|
|00003d10| 6e 67 2c 20 77 68 69 63 | 68 20 69 73 20 6e 65 63 |ng, whic|h is nec|
|00003d20| 65 73 73 61 72 79 20 62 | 65 63 61 75 73 65 20 57 |essary b|ecause W|
|00003d30| 69 6e 64 6f 77 32 58 57 | 69 6e 64 6f 77 20 72 65 |indow2XW|indow re|
|00003d40| 74 75 72 6e 73 20 61 6e | 0d 20 20 20 2f 2f 20 78 |turns an|. // x|
|00003d50| 57 69 6e 64 6f 77 2c 20 | 6e 6f 74 20 61 20 6d 79 |Window, |not a my|
|00003d60| 57 69 6e 64 6f 77 2e 0d | 20 20 20 2f 2f 20 20 20 |Window..| // |
|00003d70| 20 4e 6f 74 65 3a 20 54 | 68 65 20 74 65 73 74 20 | Note: T|he test |
|00003d80| 69 6e 20 74 68 65 20 66 | 69 72 73 74 20 6c 69 6e |in the f|irst lin|
|00003d90| 65 20 73 68 6f 75 6c 64 | 20 61 6c 77 61 79 73 20 |e should| always |
|00003da0| 62 65 20 74 72 75 65 3b | 20 49 66 20 55 70 64 61 |be true;| If Upda|
|00003db0| 74 65 4d 65 6e 75 73 20 | 0d 20 20 20 2f 2f 20 69 |teMenus |. // i|
|00003dc0| 73 20 63 6f 72 72 65 63 | 74 2c 20 74 68 65 20 43 |s correc|t, the C|
|00003dd0| 6c 65 61 72 20 63 6f 6d | 6d 61 6e 64 20 77 69 6c |lear com|mand wil|
|00003de0| 6c 20 62 65 20 64 69 73 | 61 62 6c 65 64 20 75 6e |l be dis|abled un|
|00003df0| 6c 65 73 73 20 69 74 20 | 69 73 20 61 70 70 72 6f |less it |is appro|
|00003e00| 70 72 69 61 74 65 0d 20 | 20 20 78 57 69 6e 64 6f |priate. | xWindo|
|00003e10| 77 20 2a 78 77 69 6e 3b | 0d 20 20 20 69 66 20 28 |w *xwin;|. if (|
|00003e20| 20 69 74 65 6d 4e 75 6d | 20 3d 3d 20 36 20 26 26 | itemNum| == 6 &&|
|00003e30| 20 78 57 69 6e 64 6f 77 | 3a 3a 57 69 6e 64 6f 77 | xWindow|::Window|
|00003e40| 32 58 57 69 6e 64 6f 77 | 28 46 72 6f 6e 74 57 69 |2XWindow|(FrontWi|
|00003e50| 6e 64 6f 77 28 29 2c 26 | 78 77 69 6e 29 20 29 0d |ndow(),&|xwin) ).|
|00003e60| 20 20 20 20 20 20 28 28 | 6d 79 57 69 6e 64 6f 77 | ((|myWindow|
|00003e70| 2a 29 78 77 69 6e 29 2d | 3e 64 6f 43 6c 65 61 72 |*)xwin)-|>doClear|
|00003e80| 28 29 3b 0d 7d 0d 0d 76 | 6f 69 64 20 44 6f 46 69 |();.}..v|oid DoFi|
|00003e90| 6c 65 4d 65 6e 75 28 69 | 6e 74 20 69 74 65 6d 4e |leMenu(i|nt itemN|
|00003ea0| 75 6d 2c 20 69 6e 74 2a | 20 64 6f 6e 65 29 20 7b |um, int*| done) {|
|00003eb0| 0d 20 20 20 2f 2f 20 54 | 68 69 73 20 66 75 6e 63 |. // T|his func|
|00003ec0| 74 69 6f 6e 20 68 61 73 | 20 62 65 65 6e 20 6d 6f |tion has| been mo|
|00003ed0| 64 69 66 69 65 64 20 74 | 6f 20 72 65 66 6c 65 63 |dified t|o reflec|
|00003ee0| 74 20 74 68 65 20 6e 65 | 77 20 63 6f 6d 6d 61 6e |t the ne|w comman|
|00003ef0| 64 73 20 28 53 61 76 65 | 20 61 6e 64 0d 20 20 20 |ds (Save| and. |
|00003f00| 2f 2f 20 4f 70 65 6e 29 | 20 61 64 64 65 64 20 74 |// Open)| added t|
|00003f10| 6f 20 74 68 65 20 66 69 | 6c 65 20 6d 65 6e 75 20 |o the fi|le menu |
|00003f20| 69 6e 20 49 6e 69 74 41 | 70 70 6c 69 63 61 74 69 |in InitA|pplicati|
|00003f30| 6f 6e 2e 0d 20 20 20 78 | 57 69 6e 64 6f 77 20 2a |on.. x|Window *|
|00003f40| 77 69 6e 3b 0d 20 20 20 | 69 66 20 28 69 74 65 6d |win;. |if (item|
|00003f50| 4e 75 6d 20 3d 3d 20 36 | 29 20 20 2f 2f 20 63 68 |Num == 6|) // ch|
|00003f60| 61 6e 67 65 64 20 6e 75 | 6d 62 65 72 20 6f 66 20 |anged nu|mber of |
|00003f70| 71 75 69 74 20 63 6f 6d | 6d 61 6e 64 20 66 72 6f |quit com|mand fro|
|00003f80| 6d 20 34 20 74 6f 20 36 | 0d 20 20 20 20 20 20 2a |m 4 to 6|. *|
|00003f90| 64 6f 6e 65 20 3d 20 31 | 3b 0d 20 20 20 65 6c 73 |done = 1|;. els|
|00003fa0| 65 20 69 66 20 28 69 74 | 65 6d 4e 75 6d 20 3d 3d |e if (it|emNum ==|
|00003fb0| 20 31 29 0d 20 20 20 20 | 20 20 44 6f 4e 65 77 43 | 1). | DoNewC|
|00003fc0| 6f 6d 6d 61 6e 64 28 29 | 3b 0d 20 20 20 65 6c 73 |ommand()|;. els|
|00003fd0| 65 20 69 66 20 28 69 74 | 65 6d 4e 75 6d 20 3d 3d |e if (it|emNum ==|
|00003fe0| 20 32 29 0d 20 20 20 20 | 20 20 64 6f 4f 70 65 6e | 2). | doOpen|
|00003ff0| 28 29 3b 0d 20 20 20 65 | 6c 73 65 20 69 66 20 28 |();. e|lse if (|
|00004000| 69 74 65 6d 4e 75 6d 20 | 3d 3d 20 33 20 26 26 20 |itemNum |== 3 && |
|00004010| 78 57 69 6e 64 6f 77 3a | 3a 57 69 6e 64 6f 77 32 |xWindow:|:Window2|
|00004020| 58 57 69 6e 64 6f 77 28 | 46 72 6f 6e 74 57 69 6e |XWindow(|FrontWin|
|00004030| 64 6f 77 28 29 2c 26 77 | 69 6e 29 29 0d 20 20 20 |dow(),&w|in)). |
|00004040| 20 20 20 28 28 6d 79 57 | 69 6e 64 6f 77 2a 29 77 | ((myW|indow*)w|
|00004050| 69 6e 29 2d 3e 64 6f 53 | 61 76 65 28 29 3b 0d 20 |in)->doS|ave();. |
|00004060| 20 20 65 6c 73 65 20 69 | 66 20 28 69 74 65 6d 4e | else i|f (itemN|
|00004070| 75 6d 20 3d 3d 20 34 20 | 26 26 20 78 57 69 6e 64 |um == 4 |&& xWind|
|00004080| 6f 77 3a 3a 57 69 6e 64 | 6f 77 32 58 57 69 6e 64 |ow::Wind|ow2XWind|
|00004090| 6f 77 28 46 72 6f 6e 74 | 57 69 6e 64 6f 77 28 29 |ow(Front|Window()|
|000040a0| 2c 26 77 69 6e 29 29 0d | 20 20 20 20 20 20 77 69 |,&win)).| wi|
|000040b0| 6e 2d 3e 43 6c 6f 73 65 | 28 29 3b 0d 7d 0d 0d 76 |n->Close|();.}..v|
|000040c0| 6f 69 64 20 44 6f 4f 74 | 68 65 72 4d 65 6e 75 28 |oid DoOt|herMenu(|
|000040d0| 69 6e 74 20 6d 65 6e 75 | 49 44 2c 20 69 6e 74 20 |int menu|ID, int |
|000040e0| 69 74 65 6d 4e 75 6d 29 | 20 7b 0d 7d 0d 0d 76 6f |itemNum)| {.}..vo|
|000040f0| 69 64 20 41 70 70 6c 69 | 63 61 74 69 6f 6e 49 64 |id Appli|cationId|
|00004100| 6c 65 28 76 6f 69 64 29 | 20 7b 0d 7d 0d 0d 76 6f |le(void)| {.}..vo|
|00004110| 69 64 20 43 6c 65 61 6e | 55 70 41 70 70 6c 69 63 |id Clean|UpApplic|
|00004120| 61 74 69 6f 6e 28 76 6f | 69 64 29 20 7b 0d 7d 0d |ation(vo|id) {.}.|
|00004130| 0d 76 6f 69 64 20 41 62 | 6f 75 74 42 6f 78 28 76 |.void Ab|outBox(v|
|00004140| 6f 69 64 29 20 7b 0d 20 | 20 20 2f 2f 20 54 68 65 |oid) {. | // The|
|00004150| 20 73 74 72 69 6e 67 73 | 20 69 6e 20 74 68 65 20 | strings| in the |
|00004160| 63 61 6c 6c 20 74 6f 20 | 50 61 72 61 6d 54 65 78 |call to |ParamTex|
|00004170| 74 20 68 61 76 65 20 62 | 65 65 6e 20 6d 6f 64 69 |t have b|een modi|
|00004180| 66 69 65 64 20 74 6f 20 | 64 65 73 63 72 69 62 65 |fied to |describe|
|00004190| 0d 20 20 20 2f 2f 20 74 | 68 69 73 20 70 72 6f 67 |. // t|his prog|
|000041a0| 72 61 6d 2e 20 20 28 41 | 67 61 69 6e 2c 20 74 68 |ram. (A|gain, th|
|000041b0| 69 73 20 69 73 20 6e 6f | 74 20 61 20 73 65 63 75 |is is no|t a secu|
|000041c0| 72 65 20 77 61 79 20 6f | 66 20 69 64 65 6e 74 69 |re way o|f identi|
|000041d0| 66 79 69 6e 67 20 79 6f | 75 72 0d 20 20 20 2f 2f |fying yo|ur. //|
|000041e0| 20 70 72 6f 67 72 61 6d | 2c 20 61 73 20 6e 6f 74 | program|, as not|
|000041f0| 65 64 20 69 6e 20 74 68 | 65 20 63 6f 6d 6d 65 6e |ed in th|e commen|
|00004200| 74 73 20 6f 6e 20 66 69 | 6c 65 20 61 70 70 6c 69 |ts on fi|le appli|
|00004210| 63 61 74 69 6f 6e 50 72 | 6f 63 73 2e 63 2e 29 0d |cationPr|ocs.c.).|
|00004220| 20 20 20 50 61 72 61 6d | 54 65 78 74 28 20 22 5c | Param|Text( "\|
|00004230| 70 4b 61 6c 65 69 64 6f | 53 6b 65 74 63 68 22 2c |pKaleido|Sketch",|
|00004240| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 22 |. | "|
|00004250| 5c 70 44 61 76 69 64 20 | 45 63 6b 22 2c 0d 20 20 |\pDavid |Eck",. |
|00004260| 20 20 20 20 20 20 20 20 | 20 20 20 20 22 5c 70 48 | | "\pH|
|00004270| 6f 62 61 72 74 20 61 6e | 64 20 57 69 6c 6c 69 61 |obart an|d Willia|
|00004280| 6d 20 53 6d 69 74 68 20 | 43 6f 6c 6c 65 67 65 73 |m Smith |Colleges|
|00004290| 5c 72 47 65 6e 65 76 61 | 2c 20 4e 59 20 20 31 34 |\rGeneva|, NY 14|
|000042a0| 34 35 36 5c 72 45 2d 6d | 61 69 6c 3a 20 20 65 63 |456\rE-m|ail: ec|
|000042b0| 6b 40 68 77 73 2e 62 69 | 74 6e 65 74 22 2c 0d 20 |k@hws.bi|tnet",. |
|000042c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 22 5c 70 | | "\p|
|000042d0| 54 68 69 73 20 70 72 6f | 67 72 61 6d 20 77 61 73 |This pro|gram was|
|000042e0| 20 77 72 69 74 74 65 6e | 20 69 6e 20 54 48 49 4e | written| in THIN|
|000042f0| 4b 20 43 20 74 6f 20 69 | 6c 6c 75 73 74 72 61 74 |K C to i|llustrat|
|00004300| 65 20 74 68 65 20 75 73 | 65 20 6f 66 20 61 20 4d |e the us|e of a M|
|00004310| 61 63 69 6e 74 6f 73 68 | 20 61 70 70 6c 69 63 61 |acintosh| applica|
|00004320| 74 69 6f 6e 20 73 68 65 | 6c 6c 20 74 68 61 74 20 |tion she|ll that |
|00004330| 49 20 77 72 6f 74 65 2e | 22 29 3b 0d 20 20 20 41 |I wrote.|");. A|
|00004340| 6c 65 72 74 28 31 32 38 | 2c 30 4c 29 3b 0d 7d 0d |lert(128|,0L);.}.|
|00004350| 0d 76 6f 69 64 20 44 6f | 4e 65 77 43 6f 6d 6d 61 |.void Do|NewComma|
|00004360| 6e 64 28 76 6f 69 64 29 | 20 7b 0d 20 20 20 2f 2f |nd(void)| {. //|
|00004370| 20 54 68 69 73 20 66 75 | 6e 63 74 69 6f 6e 20 68 | This fu|nction h|
|00004380| 61 73 20 62 65 65 6e 20 | 6d 6f 64 69 66 69 65 64 |as been |modified|
|00004390| 20 74 6f 20 6b 65 65 70 | 20 74 72 61 63 6b 20 6f | to keep| track o|
|000043a0| 66 20 68 6f 77 20 6d 61 | 6e 79 20 77 69 6e 64 6f |f how ma|ny windo|
|000043b0| 77 73 20 68 61 76 65 0d | 20 20 20 2f 2f 20 62 65 |ws have.| // be|
|000043c0| 65 6e 20 6f 70 65 6e 65 | 64 20 61 6e 64 20 74 6f |en opene|d and to|
|000043d0| 20 6e 61 6d 65 20 74 68 | 65 6d 20 61 70 70 72 6f | name th|em appro|
|000043e0| 70 72 69 61 74 65 6c 79 | 3a 20 55 6e 74 69 74 6c |priately|: Untitl|
|000043f0| 65 64 20 31 2c 20 55 6e | 74 69 74 6c 65 64 20 32 |ed 1, Un|titled 2|
|00004400| 2c 20 2e 2e 2e 0d 20 20 | 20 2f 2f 20 54 68 65 72 |, .... | // Ther|
|00004410| 65 20 61 72 65 20 73 6f | 6d 65 20 74 72 69 63 6b |e are so|me trick|
|00004420| 73 20 68 65 72 65 20 62 | 65 63 61 75 73 65 20 77 |s here b|ecause w|
|00004430| 69 6e 2d 3e 6f 70 65 6e | 28 74 69 74 6c 65 29 20 |in->open|(title) |
|00004440| 72 65 71 75 69 72 65 73 | 20 61 0d 20 20 20 2f 2f |requires| a. //|
|00004450| 20 50 61 73 63 61 6c 20 | 73 74 79 6c 65 20 73 74 | Pascal |style st|
|00004460| 72 69 6e 67 2c 20 62 75 | 74 20 69 74 20 69 73 20 |ring, bu|t it is |
|00004470| 65 61 73 69 65 73 74 20 | 74 6f 20 70 72 6f 64 75 |easiest |to produ|
|00004480| 63 65 20 74 68 65 20 74 | 69 74 6c 65 20 75 73 69 |ce the t|itle usi|
|00004490| 6e 67 0d 20 20 20 2f 2f | 20 73 70 72 69 6e 74 66 |ng. //| sprintf|
|000044a0| 2c 20 77 68 69 63 68 20 | 6d 61 6b 65 73 20 61 20 |, which |makes a |
|000044b0| 43 20 73 74 79 6c 65 20 | 73 74 72 69 6e 67 2e 20 |C style |string. |
|000044c0| 20 54 68 69 73 20 72 65 | 71 75 69 72 65 73 20 74 | This re|quires t|
|000044d0| 68 65 20 63 6f 6e 76 65 | 72 73 69 6f 6e 0d 20 20 |he conve|rsion. |
|000044e0| 20 2f 2f 20 43 74 6f 50 | 73 74 72 20 61 6e 64 20 | // CtoP|str and |
|000044f0| 74 68 65 20 74 79 70 65 | 2d 63 61 73 74 20 6f 66 |the type|-cast of|
|00004500| 20 74 69 74 6c 65 20 69 | 6e 20 74 68 65 20 63 61 | title i|n the ca|
|00004510| 6c 6c 20 74 6f 20 73 70 | 72 69 6e 74 66 2e 0d 20 |ll to sp|rintf.. |
|00004520| 20 20 2f 2f 20 54 68 69 | 73 20 74 79 70 65 2d 63 | // Thi|s type-c|
|00004530| 61 73 74 20 69 73 20 72 | 65 71 75 69 72 65 64 20 |ast is r|equired |
|00004540| 62 65 63 61 75 73 65 20 | 53 74 72 32 35 35 20 69 |because |Str255 i|
|00004550| 73 20 74 79 70 65 20 28 | 75 6e 73 69 67 6e 65 64 |s type (|unsigned|
|00004560| 20 63 68 61 72 29 2a 0d | 20 20 20 2f 2f 20 61 6e | char)*.| // an|
|00004570| 64 20 73 70 72 69 6e 74 | 66 20 72 65 71 75 69 72 |d sprint|f requir|
|00004580| 65 73 20 63 68 61 72 2a | 20 20 28 49 20 74 68 69 |es char*| (I thi|
|00004590| 6e 6b 29 2e 0d 20 20 20 | 2f 2f 20 28 42 79 20 74 |nk).. |// (By t|
|000045a0| 68 65 20 77 61 79 2c 20 | 73 70 72 69 6e 74 66 20 |he way, |sprintf |
|000045b0| 72 65 71 75 69 72 65 73 | 20 74 68 61 74 20 74 68 |requires| that th|
|000045c0| 69 73 20 66 69 6c 65 20 | 69 6e 63 6c 75 64 65 20 |is file |include |
|000045d0| 73 74 64 69 6f 2e 68 2c | 20 77 68 69 63 68 20 69 |stdio.h,| which i|
|000045e0| 73 0d 20 20 20 2f 2f 20 | 64 6f 6e 65 20 69 6e 64 |s. // |done ind|
|000045f0| 69 72 65 63 74 6c 79 20 | 74 68 72 6f 75 67 68 20 |irectly |through |
|00004600| 74 68 65 20 68 65 61 64 | 65 72 20 69 6e 70 75 74 |the head|er input|
|00004610| 42 6f 78 65 73 2e 68 20 | 73 6f 20 69 74 20 69 73 |Boxes.h |so it is|
|00004620| 20 6e 6f 74 20 6e 65 63 | 65 73 73 61 72 79 0d 20 | not nec|essary. |
|00004630| 20 20 2f 2f 20 74 6f 20 | 69 6e 63 6c 75 64 65 20 | // to |include |
|00004640| 69 74 20 65 78 70 6c 63 | 69 74 65 6c 79 2e 29 0d |it explc|itely.).|
|00004650| 20 20 20 6d 79 57 69 6e | 64 6f 77 20 2a 77 69 6e | myWin|dow *win|
|00004660| 3b 0d 20 20 20 53 74 72 | 32 35 35 20 74 69 74 6c |;. Str|255 titl|
|00004670| 65 3b 0d 20 20 20 77 69 | 6e 20 3d 20 6e 65 77 20 |e;. wi|n = new |
|00004680| 6d 79 57 69 6e 64 6f 77 | 3b 0d 20 20 20 57 69 6e |myWindow|;. Win|
|00004690| 64 6f 77 43 74 2b 2b 3b | 0d 20 20 20 73 70 72 69 |dowCt++;|. spri|
|000046a0| 6e 74 66 28 28 63 68 61 | 72 2a 29 74 69 74 6c 65 |ntf((cha|r*)title|
|000046b0| 2c 22 55 6e 74 69 74 6c | 65 64 20 25 69 22 2c 57 |,"Untitl|ed %i",W|
|000046c0| 69 6e 64 6f 77 43 74 29 | 3b 0d 20 20 20 43 74 6f |indowCt)|;. Cto|
|000046d0| 50 73 74 72 28 74 69 74 | 6c 65 29 3b 0d 20 20 20 |Pstr(tit|le);. |
|000046e0| 77 69 6e 2d 3e 4f 70 65 | 6e 28 74 69 74 6c 65 29 |win->Ope|n(title)|
|000046f0| 3b 0d 7d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |;.}.....|........|
|00004700| 00 00 01 00 00 00 02 ec | 00 00 01 ec 00 00 00 32 |........|.......2|
|00004710| 77 3a 3a 57 69 6e 64 6f | 77 32 58 57 69 6e 64 6f |w::Windo|w2XWindo|
|00004720| 77 28 28 57 69 6e 64 6f | 77 50 74 72 29 67 45 76 |w((Windo|wPtr)gEv|
|00004730| 0f 6b 61 6c 65 69 64 6f | 53 6b 65 74 63 68 2e 63 |.kaleido|Sketch.c|
|00004740| 02 00 00 00 50 61 72 74 | 53 49 54 78 00 00 00 00 |....Part|SITx....|
|00004750| 00 00 50 61 72 74 53 49 | 54 78 00 00 00 00 00 00 |..PartSI|Tx......|
|00004760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004770| 00 00 a9 80 1b 71 00 00 | 00 00 00 00 03 1e 20 20 |.....q..|...... |
|00004780| 20 7d 0d 20 20 20 20 20 | 20 20 20 20 20 63 61 73 | }. | cas|
|00004790| 65 20 61 63 74 69 76 61 | 74 65 45 76 74 3a 20 7b |e activa|teEvt: {|
|000047a0| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 69 66 |. | if|
|000047b0| 20 28 78 57 69 6e 64 6f | 77 3a 3a 57 69 6e 64 6f | (xWindo|w::Windo|
|000047c0| 77 32 58 57 69 6e 64 6f | 77 28 28 57 69 6e 64 6f |w2XWindo|w((Windo|
|000047d0| 77 50 74 72 29 67 45 76 | 65 6e 74 2e 6d 65 73 73 |wPtr)gEv|ent.mess|
|000047e0| 61 67 65 2c 26 77 69 6e | 29 29 0d 20 20 20 20 20 |age,&win|)). |
|000047f0| 20 20 20 20 20 20 20 20 | 20 20 20 77 69 6e 2d 3e | | win->|
|00004800| 00 00 01 e8 00 13 00 00 | 40 b6 00 00 40 be 09 41 |........|@...@..A|
|00004810| 62 6f 75 74 42 6f 78 00 | 00 00 40 73 00 00 40 82 |boutBox.|..@s..@.|
|00004820| 0f 41 70 70 6c 69 63 61 | 74 69 6f 6e 49 64 6c 65 |.Applica|tionIdle|
|00004830| 00 00 40 93 00 00 40 a5 | 13 43 6c 65 61 6e 55 70 |..@...@.|.CleanUp|
|00004840| 41 70 70 6c 69 63 61 74 | 69 6f 6e 00 00 00 3b de |Applicat|ion...;.|
|00004850| 00 00 3b e8 0b 44 6f 45 | 64 69 74 4d 65 6e 75 00 |..;..DoE|ditMenu.|
|00004860| 00 00 3e 0c 00 00 3e 16 | 0b 44 6f 46 69 6c 65 4d |..>...>.|.DoFileM|
|00004870| 65 6e 75 00 00 00 42 d6 | 00 00 42 e2 0d 44 6f 4e |enu...B.|..B..DoN|
|00004880| 65 77 43 6f 6d 6d 61 6e | 64 00 00 00 40 44 00 00 |ewComman|d...@D..|
|00004890| 40 4f 0b 44 6f 4f 74 68 | 65 72 4d 65 6e 75 00 00 |@O.DoOth|erMenu..|
|000048a0| 33 46 00 00 33 55 0f 49 | 6e 69 74 41 70 70 6c 69 |3F..3U.I|nitAppli|
|000048b0| 63 61 74 69 6f 6e 00 00 | 2d af 00 00 2d c8 19 6d |cation..|-...-..m|
|000048c0| 79 57 69 6e 64 6f 77 3a | 3a 61 64 6a 75 73 74 54 |yWindow:|:adjustT|
|000048d0| 6f 4e 65 77 53 69 7a 65 | 00 00 1e de 00 00 1e ed |oNewSize|........|
|000048e0| 0f 6d 79 57 69 6e 64 6f | 77 3a 3a 43 6c 6f 73 65 |.myWindo|w::Close|
|000048f0| 00 00 32 f9 00 00 33 0d | 15 6d 79 57 69 6e 64 6f |..2...3.|.myWindo|
|00004900| 77 3a 3a 64 6f 41 63 74 | 69 76 61 74 65 00 00 00 |w::doAct|ivate...|
|00004910| 24 c3 00 00 24 db 19 6d | 79 57 69 6e 64 6f 77 3a |$...$..m|yWindow:|
|00004920| 3a 64 6f 43 6f 6e 74 65 | 6e 74 43 6c 69 63 6b 00 |:doConte|ntClick.|
|00004930| 00 00 32 73 00 00 32 86 | 13 6d 79 57 69 6e 64 6f |..2s..2.|.myWindo|
|00004940| 77 3a 3a 64 6f 48 53 63 | 72 6f 6c 6c 00 00 1f 15 |w::doHSc|roll....|
|00004950| 00 00 1f 24 0f 6d 79 57 | 69 6e 64 6f 77 3a 3a 64 |...$.myW|indow::d|
|00004960| 6f 4b 65 79 00 00 2c 24 | 00 00 2c 36 13 6d 79 57 |oKey..,$|..,6.myW|
|00004970| 69 6e 64 6f 77 3a 3a 64 | 6f 52 65 64 72 61 77 00 |indow::d|oRedraw.|
|00004980| 00 00 32 b6 00 00 32 c9 | 13 6d 79 57 69 6e 64 6f |..2...2.|.myWindo|
|00004990| 77 3a 3a 64 6f 56 53 63 | 72 6f 6c 6c 00 00 1e 4f |w::doVSc|roll...O|
|000049a0| 00 00 1e 63 15 6d 79 57 | 69 6e 64 6f 77 3a 3a 4f |...c.myW|indow::O|
|000049b0| 70 65 6e 49 6e 52 65 63 | 74 00 00 00 1c 70 00 00 |penInRec|t....p..|
|000049c0| 1c 85 15 6d 79 57 69 6e | 64 6f 77 3a 3a 53 65 74 |...myWin|dow::Set|
|000049d0| 44 65 66 61 75 6c 74 73 | 00 00 36 60 00 00 36 6b |Defaults|..6`..6k|
|000049e0| 0b 55 70 64 61 74 65 4d | 65 6e 75 73 00 00 01 00 |.UpdateM|enus....|
|000049f0| 00 00 02 ec 00 00 01 ec | 00 00 00 32 00 68 ac 9c |........|...2.h..|
|00004a00| 05 26 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.&.....2|..MPSR..|
|00004a10| 00 0a 03 ef ff ff 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+